You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
a working wallclimb script. -
What is the issue? Include screenshots / videos if possible!
it doesnt work, and i cant find the issue. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i looked everywhere, nothing helped me.
the script
local UIS = game:GetService("UserInputService")
local character = script.Parent
local player = game.Players.LocalPlayer
local humanoid = character:WaitForChild("Humanoid")
local HumRoot = character:WaitForChild("HumanoidRootPart")
local Animation = Instance.new ("Animation")
Animation.AnimationId = "rbxassetid://5940725935"
local Anim = humanoid:LoadAnimation (Animation)
local hasWallRan = false
local LastRun = tick()
function getwall()
local direction = HumRoot.CFrame.LookVector * 5
local ray = Ray.new(HumRoot.Position, direction)
local part = game.Workspace:FindPartOnRay(ray, character)
return part
end
function jumpRequest ()
if tick - LastRun >= .2 then
if humanoid:GetState() == Enum.HumanoidStateType.Freefall and not hasWallRan and getwall{} then
hasWallRan = true
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
Anim:Play{}
wait(2)
if getwall() then
humanoid:ChangeState{Enum.HumanoidStateType.Jumping}
end
end
end
end
humanoid.StateChanged:Connect(function(old, new)
if new == Enum.HumanoidStateType.Landed then
hasWallRan = false
end
if new == Enum.HumanoidStateType.Jumping then
LastRun = tick()
end
end)
UIS.JumpRequest:Connect(jumpRequest)