Rig gliding issue

Hello, I’m currently struggling with an issue with a rig, I’ve tried to do some general scripting and then ran into the issue of when the player types with W, A, S or D it makes them endlessly glide off into the distance ending up as a huge mess.

If this doesnt fit this topic please guide me in the right direction<3

local character = script.Parent
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")

for _, part in pairs(character:GetDescendants()) do
	if part:IsA("MeshPart") or part:IsA("BasePart") then
		part.CustomPhysicalProperties = PhysicalProperties.new(
			1,
			1.5,
			0,
			1,
			1
		)
	end
end

local RunService = game:GetService("RunService")

RunService.Heartbeat:Connect(function()
	local moveDirection = humanoid.MoveDirection
	local velocity = humanoidRootPart.AssemblyLinearVelocity

	if moveDirection.Magnitude < 0.1 then
		humanoidRootPart.AssemblyLinearVelocity = Vector3.new(
			velocity.X * 0.5,
			velocity.Y,
			velocity.Z * 0.5
		)
	else
		local maxSpeed = humanoid.WalkSpeed
		local horizontalVelocity = Vector3.new(velocity.X, 0, velocity.Z)

		if horizontalVelocity.Magnitude > maxSpeed then
			local normalized = horizontalVelocity.Unit
			humanoidRootPart.AssemblyLinearVelocity = Vector3.new(
				normalized.X * maxSpeed,
				velocity.Y,
				normalized.Z * maxSpeed
			)
		end
	end
end)

pretpulksteņrādītājvirzienā_ice_skates

1 Like

nevermind, the issue turned out to be the fact the model wasn’t scaled to 1 </3

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.