Procedural leg animations: local player = game:GetService("Players").LocalPlayer local character = player.Character local rootPart = character.HumanoidRootPart local head = character.UpperTorso --lower torso when actual character local camera = workspace.CurrentCamera local beam1, beam2 = workspace.beam1, workspace.beam2 local pos1, pos2 = workspace.pos1, workspace.pos2 local cf = CFrame.new local ang = CFrame.Angles local v3 = Vector3.new local ray = Ray.new local sin = math.sin local pi = math.pi local rad = math.rad local deg = math.deg local lastUpdate = 0 local targLeft, targRight = v3(), v3() local oldLeft, oldRight = v3(), v3() local updateLeft = true local leftOff, rightOff = cf(-0.5, -0.5, 0), cf( 0.5, -0.5, 0) local lastspeed = 0 local function getVel() local vel = rootPart.CFrame:vectorToObjectSpace(rootPart.Velocity) local speed = v3(vel.X, 0, vel.Z).magnitude return vel, speed end local function getDirection() local direction = camera.CFrame.lookVector local heading = math.atan2(-direction.X, -direction.Z) return heading end local function predictPosition(current, velocity, timeAhead) return current * cf(velocity * timeAhead) end local function getNextPosition(origin, zAngle, xAngle, length) local start = origin * ang(zAngle, 0, 0) * ang(0, 0, xAngle) local ray = ray(start.p, -start.UpVector * length) local hit, pos, nor = workspace:FindPartOnRayWithIgnoreList(ray, {character, beam1, beam2, pos1, pos2, workspace.Ignore}) return pos end local function getLegToUpdate(predictedcf, vel) local nextLeft = getNextPosition(predictedcf * leftOff, rad(-vel.Z), rad(vel.X), 3) local nextRight = getNextPosition(predictedcf * rightOff, rad(-vel.Z), rad(vel.X), 3) local relLeft = (predictedcf:PointToObjectSpace((nextLeft + targRight)/2) * v3(1, 0, 1)).magnitude local relRight = (predictedcf:PointToObjectSpace((nextRight + targLeft)/2) * v3(1, 0, 1)).magnitude if relRight > relLeft then return true, nextLeft else return false, nextRight end end local function updateLegs(leftOrigin, rightOrigin, leftPos, rightPos) local d1 = (leftOrigin.p - leftPos).magnitude beam1.Size = v3(0.5, 0.5, d1) beam1.CFrame = cf(leftOrigin.p, leftPos) * cf(0, 0, -d1/2) local d2 = (rightOrigin.p - rightPos).magnitude beam2.Size = v3(0.5, 0.5, d2) beam2.CFrame = cf(rightOrigin.p, rightPos) * cf(0, 0, -d2/2) end game:GetService("RunService").RenderStepped:Connect(function(s) local vel, speed = getVel() local direction = getDirection() rootPart.CFrame = cf(rootPart.Position) * ang(0, direction, 0) local leftSet, rightSet if speed > 0 or math.abs(lastspeed-speed)/s > 0 then local delayOf = 0.2 if lastUpdate + delayOf < tick() then lastUpdate = tick() local predictedcf = predictPosition(head.CFrame, vel, delayOf)--*1.5) local leftLeg, setPos = getLegToUpdate(predictedcf, vel) updateLeft = leftLeg if leftLeg then oldLeft = targLeft targLeft = setPos else oldRight = targRight targRight = setPos end end local alpha = math.min((tick()-lastUpdate)/(delayOf/2), 1) if updateLeft then leftSet = oldLeft:lerp(targLeft, alpha) + v3(0, 0.75*sin(pi*alpha), 0) rightSet = targRight else rightSet = oldRight:lerp(targRight, alpha) + v3(0, 0.75*sin(pi*alpha), 0) leftSet = targLeft end else targLeft = getNextPosition(head.CFrame * leftOff, rad(10), rad(-5), 3) targRight = getNextPosition(head.CFrame * rightOff, rad(-10), rad(5), 3) oldLeft, oldRight = targLeft, targRight leftSet, rightSet = targLeft, targRight end pos1.Position = leftSet pos2.Position = rightSet updateLegs(head.CFrame * leftOff, head.CFrame * rightOff, leftSet, rightSet) lastspeed = speed end)
Heya! I'm guessing you can't move because of the ball? There's a pretty simple fix for that and all you need to do is Turn off CanCollide on the ball. Hope this helps!
I must put body name or part on the script for ball? Also, did you remove the ball after the script done because it randomly appear at replicated strorage. Sorry for so much complain :( btw new sub
Yes, you do need to put the name of the ball/custom char Inside of the script. The ball also needs to be placed inside of replicated storage. And no I did not remove the ball I just turned off the CanCollide property on it.
Invisible Player script incase you need: -- Function to make a player's character invisible local function makePlayerInvisible(player) local character = player.Character or player.CharacterAdded:Wait() for _, part in pairs(character:GetDescendants()) do if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then part.Transparency = 1 -- Makes the part invisible part.CanCollide = false -- Prevents collisions elseif part:IsA("Decal") then part.Transparency = 1 -- Hides face decals end end end -- Trigger invisibility when a player joins game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function() wait(1) -- Allow the character to load fully makePlayerInvisible(player) end) end)
@@axolol-i have a slight problem with the script Because when i tried it when using the script, the script thinks the Head of the custom character is a part of the head that is why i Will make the entire body gone except for the head
Procedural leg animations:
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local rootPart = character.HumanoidRootPart
local head = character.UpperTorso --lower torso when actual character
local camera = workspace.CurrentCamera
local beam1, beam2 = workspace.beam1, workspace.beam2
local pos1, pos2 = workspace.pos1, workspace.pos2
local cf = CFrame.new
local ang = CFrame.Angles
local v3 = Vector3.new
local ray = Ray.new
local sin = math.sin
local pi = math.pi
local rad = math.rad
local deg = math.deg
local lastUpdate = 0
local targLeft, targRight = v3(), v3()
local oldLeft, oldRight = v3(), v3()
local updateLeft = true
local leftOff, rightOff = cf(-0.5, -0.5, 0), cf( 0.5, -0.5, 0)
local lastspeed = 0
local function getVel()
local vel = rootPart.CFrame:vectorToObjectSpace(rootPart.Velocity)
local speed = v3(vel.X, 0, vel.Z).magnitude
return vel, speed
end
local function getDirection()
local direction = camera.CFrame.lookVector
local heading = math.atan2(-direction.X, -direction.Z)
return heading
end
local function predictPosition(current, velocity, timeAhead)
return current * cf(velocity * timeAhead)
end
local function getNextPosition(origin, zAngle, xAngle, length)
local start = origin * ang(zAngle, 0, 0) * ang(0, 0, xAngle)
local ray = ray(start.p, -start.UpVector * length)
local hit, pos, nor = workspace:FindPartOnRayWithIgnoreList(ray, {character, beam1, beam2, pos1, pos2, workspace.Ignore})
return pos
end
local function getLegToUpdate(predictedcf, vel)
local nextLeft = getNextPosition(predictedcf * leftOff, rad(-vel.Z), rad(vel.X), 3)
local nextRight = getNextPosition(predictedcf * rightOff, rad(-vel.Z), rad(vel.X), 3)
local relLeft = (predictedcf:PointToObjectSpace((nextLeft + targRight)/2) * v3(1, 0, 1)).magnitude
local relRight = (predictedcf:PointToObjectSpace((nextRight + targLeft)/2) * v3(1, 0, 1)).magnitude
if relRight > relLeft then
return true, nextLeft
else
return false, nextRight
end
end
local function updateLegs(leftOrigin, rightOrigin, leftPos, rightPos)
local d1 = (leftOrigin.p - leftPos).magnitude
beam1.Size = v3(0.5, 0.5, d1)
beam1.CFrame = cf(leftOrigin.p, leftPos) * cf(0, 0, -d1/2)
local d2 = (rightOrigin.p - rightPos).magnitude
beam2.Size = v3(0.5, 0.5, d2)
beam2.CFrame = cf(rightOrigin.p, rightPos) * cf(0, 0, -d2/2)
end
game:GetService("RunService").RenderStepped:Connect(function(s)
local vel, speed = getVel()
local direction = getDirection()
rootPart.CFrame = cf(rootPart.Position) * ang(0, direction, 0)
local leftSet, rightSet
if speed > 0 or math.abs(lastspeed-speed)/s > 0 then
local delayOf = 0.2
if lastUpdate + delayOf < tick() then
lastUpdate = tick()
local predictedcf = predictPosition(head.CFrame, vel, delayOf)--*1.5)
local leftLeg, setPos = getLegToUpdate(predictedcf, vel)
updateLeft = leftLeg
if leftLeg then
oldLeft = targLeft
targLeft = setPos
else
oldRight = targRight
targRight = setPos
end
end
local alpha = math.min((tick()-lastUpdate)/(delayOf/2), 1)
if updateLeft then
leftSet = oldLeft:lerp(targLeft, alpha) + v3(0, 0.75*sin(pi*alpha), 0)
rightSet = targRight
else
rightSet = oldRight:lerp(targRight, alpha) + v3(0, 0.75*sin(pi*alpha), 0)
leftSet = targLeft
end
else
targLeft = getNextPosition(head.CFrame * leftOff, rad(10), rad(-5), 3)
targRight = getNextPosition(head.CFrame * rightOff, rad(-10), rad(5), 3)
oldLeft, oldRight = targLeft, targRight
leftSet, rightSet = targLeft, targRight
end
pos1.Position = leftSet
pos2.Position = rightSet
updateLegs(head.CFrame * leftOff, head.CFrame * rightOff, leftSet, rightSet)
lastspeed = speed
end)
You could just put it in the description it's more easier to copy
@@JimxyneilGalvajarOk so about that. I can't, because for some weird reason RUclips doesn't allow angled brackets on descriptions.
/copy
/copy
Why don't you just upload another vidoe with titled "Procedular Legs Anim!" And put script in Desc
This guy will be the next star in studio lite community 🎉
Thank you so much!
@@axolol-hi
Hiya!
Wait, did you remove the ball? Cus i cant do anything cus of the ball. I wanna know if you delete it
New sub :D
Heya! I'm guessing you can't move because of the ball? There's a pretty simple fix for that and all you need to do is Turn off CanCollide on the ball.
Hope this helps!
Oh thanks!
I must put body name or part on the script for ball? Also, did you remove the ball after the script done because it randomly appear at replicated strorage. Sorry for so much complain :( btw new sub
Yes, you do need to put the name of the ball/custom char Inside of the script. The ball also needs to be placed inside of replicated storage. And no I did not remove the ball I just turned off the CanCollide property on it.
thank you sir
I can't copy the comment :(
You can go into chrome and copy my comment that way
We be making eg with this one
Eg 🗣️🔥🔥🗣️🔥🔥🔥
Invisible Player script incase you need:
-- Function to make a player's character invisible
local function makePlayerInvisible(player)
local character = player.Character or player.CharacterAdded:Wait()
for _, part in pairs(character:GetDescendants()) do
if part:IsA("BasePart") and part.Name ~= "HumanoidRootPart" then
part.Transparency = 1 -- Makes the part invisible
part.CanCollide = false -- Prevents collisions
elseif part:IsA("Decal") then
part.Transparency = 1 -- Hides face decals
end
end
end
-- Trigger invisibility when a player joins
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
wait(1) -- Allow the character to load fully
makePlayerInvisible(player)
end)
end)
Hi! Sorry for the delay for some reason RUclips is marking your comment as held. (Which basically hides ur comment)
Is ok@@axolol-
@@axolol-i have a slight problem with the script Because when i tried it when using the script, the script thinks the Head of the custom character is a part of the head that is why i Will make the entire body gone except for the head
@@a_random_white_guyHmm, maybe try to detect for MeshParts only and not BaseParts.
For example:
if part:IsA("MeshPart") then
--invisibility here
@@axolol-Oka
Now to make the legs disappears?
You can use @a_random_white_guy script