I'm trying to do a walljump script the problem is that it doesn't work propperly,and every change that i do have 2 outcomes.
1-Just don't work
2-The player starts flying forever to the right of the character.
Here's the walljump script
local acceleration = require(workspace.acelleration) local UIS = game:GetService("UserInputService") local localPlayer = game.Players.LocalPlayer local character = game.Players.LocalPlayer.Character local humanoid = script.Parent:WaitForChild("Humanoid") local root = character:WaitForChild("HumanoidRootPart") humanoid.Touched:connect(function(tp, hl) if hl.Name == "LeftUpperArm" and humanoid:GetState() == Enum.HumanoidStateType.Freefall then game.StarterPlayer.StarterCharacterScripts.doublejump.Disabled = true print("leftsurface") repeat if UIS.InputBegan == Enum.KeyCode.Space then humanoid:ChangeState(Enum.HumanoidStateType.Jumping) root.Velocity = (root.CFrame.RightVector+root.CFrame.LookVector*0.2)*(40+acceleration*2) break end wait () until not hl.Name == "LeftUpperArm" or humanoid:GetState() == Enum.HumanoidStateType.Landed end if hl.Name == "RightUpperArm" and humanoid:GetState() == Enum.HumanoidStateType.Freefall then game.StarterPlayer.StarterCharacterScripts.doublejump.Disabled = true print("Rightsurface") repeat if UIS.InputBegan == Enum.KeyCode.Space then humanoid:ChangeState(Enum.HumanoidStateType.Jumping) root.Velocity = (root.CFrame.RightVector*-1+root.CFrame.LookVector*0.2)*(40+acceleration*2) break end wait () until not hl.Name == "RightUpperArm" or humanoid:GetState() == Enum.HumanoidStateType.Landed or Break end local r = Ray.new(root.Position, root.CFrame.lookVector * 5) local hit, pos = workspace:FindPartOnRay(r, character) if (hit) and humanoid:GetState() == Enum.HumanoidStateType.Freefall then print("middlesurface") root.CFrame = CFrame.Angles(0,math.rad(90),0)+ root.CFrame.p else end game.StarterPlayer.StarterCharacterScripts.doublejump.Disabled = false end)