How Come This Function Wont Work

i made this function for my parkour system yet it doesnt work when put with uis im confused as the code looks like it should work

	if WallKicking == false and Rolling == false and Sliding == false then
		Sliding = true
		local Animation = Humanoid:LoadAnimation(Animations:WaitForChild("Slide"))
		local BodyVelocity = Instance.new("BodyVelocity") --// Deprecated //--
		BodyVelocity.MaxForce = Vector3.new(1,3,1) * 30000
		BodyVelocity.Velocity = Vector3.new((Character.HumanoidRootPart.CFrame.lookVector.X * 30),30,(Character.HumanoidRootPart.CFrame.lookVector.Z * 30))
		BodyVelocity.Parent = Character.HumanoidRootPart
		wait(0.2)
		BodyVelocity:Destroy()
		Sliding = false
	end```

any ideas?
2 Likes

Can you provide the entire script so I can try to understand whats wrong? Also did you check output for any errors?

can you provide a clear explaination so I can understand what is wrong?

try printing each of these variables right above this line and see if they are all being meet as false

also try using a print inside at the top of the if to even see if its getting to that point

print( WallKicking , Rolling, Sliding)

print can be your friend

Also as they stated above you might want to include more of the script etc

no errors the script just has the variables and they are set to false.

What are you trying to accomplish? What is the goal of this “parkour system”?

You should show more of your script. There is a wait here, so your function would yield. If the function is connected to an event, then it doesn’t matter. But if it’s running in series with other code, it could be the cause of the issue.

i dont carreeeee stop replyinggggg

Excuse me? Are you trying to say that you found a solution? If so, please mark a post as solution, or reply with the solution.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.