You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am making a game that involves riding a subway train. I was creating a script that would update the player’s HumanoidRootPart’sAssemblyLinearVelocity
to the same as the object below. -
What is the issue? Include screenshots / videos if possible!
the issue is that the script does almost the opposite. when the part is barely moving the character would jitter and move around like crazy. All modifications ive attempted have either amplified the effect or just didn’t do anything at all.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
This is the code.
lp = game:GetService("Players").LocalPlayer
char = lp.Character
while lp.Character == nil do wait() char = lp.Character end
char = lp.Character
while wait() do
for _,p in pairs(char:GetDescendants()) do
if p:IsA("BasePart") or p:IsA("MeshPart") then
if char:FindFirstChild("HumanoidRootPart") then
local h
local function onHit(hit)
if p.Name ~= "HumanoidRootPart" then
p.AssemblyLinearVelocity = Vector3.new(0, 0, 0)
end
if not char:FindFirstChild(hit.Name, true) then
char.HumanoidRootPart.AssemblyLinearVelocity += hit.AssemblyLinearVelocity
end
h:Disconnect()
end
h = p.Touched:Connect(onHit)
end
end
end
end