So, I have alot of bugs I guess you could call them with my current one, and it’s my first time making it and I’m just really confused, depening on which side of the wall sometimes it doesnt correctly change the velocity of where I am and it’s just getting annoying at this point, I’ve looked on other threads on here but none of them really explained thoroughly how to do it, I really need help with this.
CODE v
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.R and not Climbing then
local climbRay = Ray.new(head.Position, head.CFrame.lookVector * 1)
local hit, position, surface = game.Workspace:FindPartOnRayWithIgnoreList(climbRay, {humrp})
local mag = (position - head.Position).Magnitude
if hit then
print(surface)
Climbing = true
hum.PlatformStand = true
print("Climbing Enabled.")
local attachment = Instance.new("Attachment")
attachment.Parent = hit
attachment.WorldCFrame = (head.CFrame * CFrame.new(0,0,-mag))
attachment.Visible = true
attachment.Name = "WallClimb"
head.CFrame = attachment.WorldCFrame
humrp.Velocity = Vector3.new(0,0,0)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(5000,5000,5000)
BodyVelocity.Velocity = Vector3.new(0,0,0)
BodyVelocity.Parent = humrp
BodyVelocity.Name = "Climb"
local BodyGyrp = Instance.new("BodyGyro")
BodyGyrp.MaxTorque = Vector3.new(0,0,0)
BodyGyrp.CFrame = CFrame.new(Vector3.new(), -surface)
BodyGyrp.Parent = humrp
Debris:AddItem(BodyVelocity, 10)
Debris:AddItem(BodyGyrp, 10)
wait(10)
Climbing = false
hum.PlatformStand = false
print(Climbing)
end
end