Unable to set LineVelocity

I’m trying to set the LineVelocity of a LinearVelocity via a script. However, it simply wont change.
Here’s my code:

local Player = game:GetService("Players").LocalPlayer
local Character = script.Parent.Parent
local HumanoidRootPart = script.Parent

local LinearVelocity = HumanoidRootPart:WaitForChild("LinearVelocity")

task.spawn(function()
	while task.wait(0.1) do
		LinearVelocity.LineVelocity = 600
	end
end)

I’ve tried this on a LocalScript as well as a ServerScript. Regarless of script type, the value does not get set. Here’s the properties of the LinearVelocity:


As you can see by the value circled in red, this is the value that does not adjust via a script.
If I set the LineVelocity prior to starting the game, it works – just for whatever reason it does not work when attempting to set it through an in game script.

There are no other scripts competing with this one, so I see no reason this should be happening.

1 Like

Fixed! It was caused by the fact that I was trying to parent the scripts to the HumanoidRootPart as opposed to StarterCharacterScripts.

Thanks :smile:

2 Likes

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