I want to have the player slowly slide down while on the wall, But it keeps breaking resulting in this
I have tried to frame but I don’t know if I was doing it wrong or if it just doesn’t work
local plr = game.Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")
local Head = Character:WaitForChild("Head")
local Hum = Character:WaitForChild("Humanoid")
local CA = Hum:LoadAnimation(script:WaitForChild("ClimbAnim"))
local HA = Hum:LoadAnimation(script:WaitForChild("HoldAnim"))
local TouchGui = plr:WaitForChild("PlayerGui"):FindFirstChild("TouchGui")
local UIS = game:GetService("UserInputService")
ledgeavailable = true
holding = false
NumberOfJumps = 3
while game:GetService("RunService").Heartbeat:Wait() do
local r = Ray.new(Head.CFrame.p, Head.CFrame.LookVector * 1.4)
local part,position = workspace:FindPartOnRay(r,Character)
if part and ledgeavailable and not holding then
if Hum.FloorMaterial == Enum.Material.Air then
if part.Name == "Wall" then
if NumberOfJumps >= 1 then
print(NumberOfJumps)
Root.Anchored = true holding = true HA:Play() ledgeavailable = false
end
end
end
end
---------------------------------------------BUGGY CHUNK
while Root.Anchored == true do
Root.Position = Root.Position - Vector3.new(0,0.1,0)
print(Root.Position)
wait()
end
---------------------------------------------BUGGY CHUNK
if Hum.FloorMaterial ~= Enum.Material.Air then
NumberOfJumps = 3
end
function climb()
NumberOfJumps = NumberOfJumps - 1
local Vele = Instance.new("BodyVelocity",Root)
Root.Anchored = false
Vele.MaxForce = Vector3.new(1,1,1) * math.huge
Vele.Velocity = Root.CFrame.LookVector * 20 + Vector3.new(0,70,0)
HA:Stop() CA:Play()
game.Debris:AddItem(Vele,.15)
holding = false
wait(.2)
ledgeavailable = true
end
UIS.InputBegan:Connect(function(Key,Chat)
if not holding then return end
if Key.KeyCode == Enum.KeyCode.Space and not Chat then
climb()
end
end)
end
`