so i have a "wall run" script and it works like whats in the code, its js a matter of making it smoother, like locking you exactly onto the walll and making it so you dont fly off. any help?
print("Script running")
local uis = game:GetService("UserInputService")
local char = script.Parent.Parent
local hum = char:WaitForChild("Humanoid")
local hrp = char:WaitForChild("HumanoidRootPart")
local Origin = hrp.Position
local rcp = RaycastParams.new()
rcp.FilterType = Enum.RaycastFilterType.Exclude
rcp.FilterDescendantsInstances = {char}
rcp.RespectCanCollide = true
local animator = hum:WaitForChild("Animator")
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://77224250156568"
local play = animator:LoadAnimation(anim)
local animator1 = hum:WaitForChild("Animator")
local anim1 = Instance.new("Animation")
anim1.AnimationId = "rbxassetid://111059167698837"
local play1 = animator:LoadAnimation(anim1)
local rightrun = false
local leftrun = false
local attachment = Instance.new("Attachment")
attachment.Parent = hrp
local LV = Instance.new("LinearVelocity")
LV.Attachment0 = attachment
LV.VectorVelocity = Vector3.zero
LV.MaxForce = math.huge
LV.Parent = hrp
LV.Enabled = false
uis.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.R then
local direction = hrp.CFrame.RightVector * 2.5
local Rraycast = workspace:Raycast(hrp.Position, direction, rcp)
if Rraycast then
rightrun = true
LV.Enabled = true
LV.VectorVelocity = hrp.CFrame.LookVector * 40
play:Play()
print(rightrun)
end
end
end)
uis.InputEnded:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.R then
LV.Enabled = false
LV.VectorVelocity = Vector3.zero
play:Stop()
rightrun = false
print(rightrun)
end
end)
uis.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.R then
local direction = -hrp.CFrame.RightVector * 2.5
local Rraycast = workspace:Raycast(hrp.Position, direction, rcp)
if Rraycast then
leftrun = true
LV.Enabled = true
LV.VectorVelocity = hrp.CFrame.LookVector * 40
play1:Play()
print(leftrun)
end
end
end)
uis.InputEnded:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.R then
LV.Enabled = false
LV.VectorVelocity = Vector3.zero
play1:Stop()
leftrun = false
print(leftrun)
end
end)
https://medal.tv/games/roblox-studio/clips/lZzruijext-KGv6ZX?invite=cr-MSxDaHMsMTk5ODIxMzc0&v=16
(ignore the anims its a placeholder till my friend actually makes the real anims)
Watch Untitled - Copy by sf5445 and millions of other Roblox Studio videos on Medal. #robloxstudio