So I was working on a little parkour game, where you can stop time to lock all parts in place. I want able to pick up blocks as tools and use them to maneuver around the map. One thing I want the player to do is to drop a block off a ledge, stop time, jump on the block, which allows them to jump to the goal. The problem is that, when I anchor the part and I jump on it, my character seems to slide off for some reason. Why is this happening?
It could be because of the angle of the parts that were frozen while falling. If you decreased the MaxSlopeAngle
inside the Humanoid, and the part is too steep, the character will slide down. You could also try setting the parts’ density to a big number (like 100) if you have CustomPhysicalProperties
enabled to stop sliding. If none of these work, please provide a video of a player sliding so I can see better whats happening.
Link
As you can see in the video, my character constantly slides off the anchored block when it’s in the air and time is stopped (the yellow filter means the timestop is activiated).
ignore my avatar lol
This is because anchoring a part does not decrease its velocity therefore it will have a “conveyor” effect.
I tried setting the velocity to 0, after it is anchored, but it didn’t work. What should I do?
did you set the angular velocity to 0 too? (and show me the code)
I did and it works now, thanks. Here’s some of the code in case you still needed to look at it:
timeEvent.OnServerEvent:Connect(function(player)
local character = player.Character
if debounce == false then
debounce = true
tweenIn:Play()
for _, v in pairs(workspace:GetDescendants()) do
if v:IsA("Part") or v:IsA("MeshPart") then
if v.Anchored == false and not v:IsDescendantOf(character) then
local savedVelocity = Instance.new("Vector3Value")
savedVelocity.Name = "SavedVelocity"
savedVelocity.Value = v.Velocity
savedVelocity.Parent = v
v.Anchored = true
v.Velocity = Vector3.new(0, 0, 0)
v.AssemblyAngularVelocity = Vector3.new(0, 0, 0)
end
elseif v:IsA("Tool") and v:FindFirstChild("Handle") then
v.Handle.CanTouch = false
end
end
wait(5)
tweenOut:Play()
for _, v in pairs(workspace:GetDescendants()) do
if v:FindFirstChild("SavedVelocity") then
if v.Anchored == true then
v.Anchored = false
v.Velocity = v.SavedVelocity.Value
v.SavedVelocity:Destroy()
end
elseif v:IsA("Tool") and v:FindFirstChild("Handle") then
v.Handle.CanTouch = true
end
end
end
wait(1)
debounce = false
end)