-
What do you want to achieve? I want the characters to be able to walk in the moving BasePart, which is a spacecraft on which players may freely walk even when it is moving. (This includes jumping, walking, performing emotes, and so forth.)
-
What is the issue? The problem is that I can’t do it; I’ve tried several scripts, such as welding the character with the BasePart, but the outcome isn’t what I needed.
-
What solutions have you tried so far? I tried Jailbreak train platform system? - #35 by Kord_K, but it didn’t work either.
I want the character to be able to walk in a moving part, such as spacecraft, aircraft, and so on. How can I employ that? I tried Weld, but it didn’t work. When a part moves quickly, the character’s movement slows down or falls down (collides with a part like glasses). How do I fix that?
Here is my script: (I use BodyGyro and BodyPosition)
local SavedPos = script.Parent.Position.Y
local VehicleSeat = script.Parent
local MaxSpeed = VehicleSeat.MaxSpeed
local Speed = 0
local BodyGyro = script.Parent.Parent:FindFirstChild("BodyGyro")
local BodyPosition = script.Parent.Parent:FindFirstChild("BodyPosition")
if not BodyGyro and not BodyPosition then
BodyGyro = Instance.new("BodyGyro")
BodyGyro.Name = "BodyGyro"
BodyGyro.Parent = script.Parent
BodyGyro.CFrame = script.Parent.CFrame
BodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
BodyPosition = Instance.new("BodyPosition")
BodyPosition.Name = "BodyPosition"
BodyPosition.Parent = script.Parent
BodyPosition.Position = Vector3.new(script.Parent.Position.X, SavedPos, script.Parent.Position.Z)
BodyPosition.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
end
print("Working here")
while true do
local throttle = VehicleSeat.Throttle
local steer = VehicleSeat.Steer
if throttle > 0 then
if (Speed < script.Parent.MaxSpeed) then
Speed += 1
end
script.Parent.BodyPosition.position = Vector3.new(script.Parent.Position.X, SavedPos, script.Parent.Position.Z) + (script.Parent.CFrame.lookVector).unit * Speed/4
elseif throttle == -1 then
if (Speed < script.Parent.MaxSpeed) then
Speed -= 1
end
BodyPosition.Position = BodyPosition.Position + Vector3.new(1, 0, 0)
elseif throttle == 0 then
if (Speed ~= 0) then
if (Speed > 0) then
Speed = Speed - 1
elseif (Speed < 0) then
Speed = Speed + 1
end
script.Parent.BodyPosition.position = Vector3.new(script.Parent.Position.X, SavedPos, script.Parent.Position.Z) + (script.Parent.CFrame.lookVector).unit * Speed/4
elseif (Speed == 0) then
script.Parent.BodyPosition.position = Vector3.new(script.Parent.Position.X, SavedPos, script.Parent.Position.Z)
end
end
if (script.Parent.Steer > 0) then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,-0.05, 0)
elseif (script.Parent.Steer < 0) then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe * CFrame.fromEulerAnglesXYZ(0,0.05, 0)
elseif (script.Parent.Steer == 0) then
script.Parent.BodyGyro.cframe = script.Parent.BodyGyro.cframe
end
wait(0.1)
end
I don’t ask you to write the script entirely, but just a little of help please. Thank you so much!