I’ve been trying to think of ways to make players turn smoothly at high walkspeeds. Basically sharp changes in direction without them sliding around. I’ve tried using BodyVelocity but the outcome was buggy with only a little improvement.
This fast turns in this game is basically what I’m trying to replicate^
local player = game.Players.LocalPlayer
local function ChangeVelocity()
if player.Character.Humanoid.MoveDirection == Vector3.new(0,0,0) then
game["Run Service"].Heartbeat:Wait()
player.Character.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new()
else
-- I previously instanced bodyvelocity here but it was buggy
end
end
player.Character.Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(ChangeVelocity)
I tried to implement the solution from this post but didn’t notice a change. Here is the updated code
local player = game.Players.LocalPlayer
local function changeFriction(part, friction, frictionWeight)
if not part.CustomPhysicalProperties then
part.CustomPhysicalProperties = PhysicalProperties.new(part.Material)
end
local orig = part.CustomPhysicalProperties
friction = friction or orig.Friction
frictionWeight = frictionWeight or orig.FrictionWeight
print(friction)
part.CustomPhysicalProperties = PhysicalProperties.new(orig.Density, friction, orig.Elasticity, frictionWeight, orig.ElasticityWeight)
end
local function ChangeVelocity()
if player.Character.Humanoid.MoveDirection == Vector3.new(0,0,0) then
game["Run Service"].Heartbeat:Wait()
player.Character.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new()
else
changeFriction(player.Character.HumanoidRootPart, 20, 20)
end
end
player.Character.Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(ChangeVelocity)
id just use a linearvelocity on the plane type, changing the x-y values based on player input. and disable it when a player is in the freefalling state, or anytime you can detect they aren’t touching the ground. i dont think the flash game uses walkspeed because when you jump you aren’t launched in the same way as if you had incredibly high walkspeed.
Why not just manually increase the Friction of all the ground Parts?
I don’t think it’ll affect other aspects too much unless you have other physical objects interacting with the ground.
I was up late last night and just realized I was changing the friction of the HumanoidRootPart which of course wouldn’t change anything. I should have been changing the friction of the player’s feet when their character is added.
local player = game.Players.LocalPlayer
local function changeFriction(part, friction, frictionWeight)
if not part.CustomPhysicalProperties then
part.CustomPhysicalProperties = PhysicalProperties.new(part.Material)
end
local orig = part.CustomPhysicalProperties
friction = friction or orig.Friction
frictionWeight = frictionWeight or orig.FrictionWeight
part.CustomPhysicalProperties = PhysicalProperties.new(orig.Density, friction, orig.Elasticity, frictionWeight, orig.ElasticityWeight)
end
changeFriction(player.Character.LeftFoot, 2, 100)
changeFriction(player.Character.RightFoot, 2, 100)
This works much better than my original script so i’ll mark your reply as the solution. Thanks for the replies and help.
If I recall correctly the Friction of the legs wouldn’t help since they are CanCollide off so the player doesn’t get tripped or hung up on things like stairs. HipHeight sets how high a player is above the ground so CanCollide off legs isn’t a problem.