Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = cloneref and cloneref(game:GetService("Players")) or game:GetService("Players")
- local RunService = cloneref and cloneref(game:GetService("RunService")) or game:GetService("RunService")
- local plr = Players.LocalPlayer
- local char = plr.Character or plr.CharacterAdded:Wait()
- local hrp = char:WaitForChild("HumanoidRootPart")
- local hum = char:WaitForChild("Humanoid")
- local ice_walk = true
- local slide_force = 180
- local friction = 0.9
- hum.WalkSpeed = 16
- local body_vel = Instance.new("BodyVelocity")
- body_vel.MaxForce = Vector3.new(1e5, 0, 1e5)
- body_vel.P = 1000
- body_vel.Velocity = Vector3.zero
- body_vel.Name = "IceSlide"
- body_vel.Parent = hrp
- local current_velocity = Vector3.zero
- RunService.RenderStepped:Connect(function(dt)
- if not char or not char.Parent then return end
- if ice_walk then
- local move_dir = hum.MoveDirection
- if move_dir.Magnitude > 0 then
- current_velocity = current_velocity + move_dir.Unit * slide_force * dt
- end
- current_velocity = current_velocity * friction
- body_vel.Velocity = Vector3.new(current_velocity.X, 0, current_velocity.Z)
- else
- current_velocity = Vector3.zero
- body_vel.Velocity = Vector3.zero
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement