I want to spawn the ship but it keeps going to a fixed location. I need help!
Check if there’s anything changing the velocity of the ship such as linear velocity
I’m guessing you’ve got a flying script in the script somewhere?
You may have to set whatever forces fly the script to 0 when it spawns in.
Either that or Anchor a Part on the ship until a player takes control of it then Unanchor that Part.
Like @sparklenico20 said has the model of the ship been saved with a force applied in it somewhere?
Are all the Parts in the model Massless?
No none of the parts are massless
Also, I should mention that the ship is in server storage and when I try and spawn it the ship wants to spawn where its stored.
Since this is the scripting helpers forum you should post the script you spawn it with.
How are you setting the ship’s spawn position with the script?
Models should be positioned using MoveTo if you want to place stack them on top of another Part or PVInstance:PivotTo() if you want to place them at a precise location and rotation.
local PurchasedCars = game.ServerStorage:WaitForChild("PurchasedCars")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SpawnCarEvent = ReplicatedStorage:WaitForChild("SpawnCar")
local DeleteCarEvent = ReplicatedStorage:WaitForChild("DeleteCar")
SpawnCarEvent.OnServerEvent:Connect(function(player, carName)
local PlayerPurchasedCars = PurchasedCars:FindFirstChild(player.Name)
if PlayerPurchasedCars then
local Car = PlayerPurchasedCars:FindFirstChild(carName)
local CurCar = game.Workspace:FindFirstChild(player.Name .. 'sCar')
if CurCar then
CurCar:Remove()
end
if Car then
local clonedCar = Car:Clone()
clonedCar.Name = player.Name .. 'sCar'
if clonedCar:IsA("Model") then
clonedCar:MakeJoints()
end
clonedCar.Parent = game.Workspace
clonedCar:MoveTo(player.Character.HumanoidRootPart.Position + player.Character.HumanoidRootPart.CFrame.LookVector * 15)
end
end
end)
DeleteCarEvent.OnServerEvent:Connect(function(player, Car)
local Car = game.Workspace:FindFirstChild(player.Name .. 'sCar')
if Car then
Car:Remove()
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local Car = game.Workspace:FindFirstChild(player.Name .. 'sCar')
if Car then
Car:Remove()
end
end)
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local Car = game.Workspace:FindFirstChild(player.Name .. 'sCar')
if Car then
Car:Remove()
end
end)
end)```
Just to help with posting your script in the proper format type 3 backticks before and after the script so it indents and highlights properly.
If the model isn’t massless then I’d select ALL the Parts in the model and set their LinearVelocities to 0 then check to see if you have any BodyMovers or Constriants Movers that have a Force or direction left that’s not 0.
The LinearVelocities are already set to 0. do you think it has anything to do with an anchor script within the model or maybe the HoverSeat?
I’m guessing you’ve got a flying script in the script somewhere?
You may have to set whatever forces fly the script to 0 when it spawns in.
Well, I already asked about your flying script and you only answered the Massless question in my post.
I’m guessing your hover seat is a flying script. You probably should have mentioned that in the first place since your ship is flying away.
local Speed = 0
while (script.Parent:findFirstChild("CanFly") == nil) do wait(0.1) end
while (script.Parent:findFirstChild("VMode") == nil) do wait(0.1) end
script.Parent.CanFly.Value = "Yes"
script.Parent.VMode.Value = "Hover"
if (script.Parent:findFirstChild("BodyPosition") == nil) then
p = Instance.new("BodyPosition")
p.Name = "BodyPosition"
p.maxForce = Vector3.new(math.huge,math.huge,math.huge)
p.position = Vector3.new(script.Parent.Position.X, SavedYPosition, script.Parent.Position.Z)
p.Parent = script.Parent
end
if (script.Parent:findFirstChild("BodyGyro") == nil) then
g = Instance.new("BodyGyro")
g.Name = "BodyGyro"
g.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
g.cframe = script.Parent.CFrame
g.Parent = script.Parent
end
while true do
if (script.Parent:findFirstChild("CanFly") ~= nil) then
if (script.Parent.CanFly.Value == "Yes") and (script.Parent.VMode.Value == "Warp") then
script.Parent.BodyPosition.position = Vector3.new(script.Parent.Position.X, SavedYPosition, script.Parent.Position.Z) + (script.Parent.CFrame.lookVector).unit * script.Parent.MaxSpeed
Speed = script.Parent.MaxSpeed * 2.5
elseif (script.Parent.CanFly.Value == "Yes") and (script.Parent.VMode.Value == "Hyper") then
script.Parent.BodyPosition.position = Vector3.new(script.Parent.Position.X, SavedYPosition, script.Parent.Position.Z) + (script.Parent.CFrame.lookVector).unit * script.Parent.MaxSpeed * 4
Speed = script.Parent.MaxSpeed * 6
elseif (script.Parent.CanFly.Value == "Yes") then
if (script.Parent.Throttle ~= 0) then
if (script.Parent.Throttle > 0) then
if (Speed < script.Parent.MaxSpeed) then
Speed = Speed + 10
end
elseif (script.Parent.Throttle < 0) then
if (-Speed < script.Parent.MaxSpeed) then
Speed = Speed - 10
end
end
script.Parent.BodyPosition.position = Vector3.new(script.Parent.Position.X, SavedYPosition, script.Parent.Position.Z) + (script.Parent.CFrame.lookVector).unit * Speed/4
elseif (script.Parent.Throttle == 0) then
if (Speed ~= 0) then
if (Speed > 0) then
Speed = Speed - 2
elseif (Speed < 0) then
Speed = Speed + 2
end
script.Parent.BodyPosition.position = Vector3.new(script.Parent.Position.X, SavedYPosition, 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, SavedYPosition, 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
if (script.Parent:findFirstChild("VMode") ~= nil) then
if (script.Parent.VMode.Value == "Up") then
SavedYPosition = SavedYPosition + 3
elseif (script.Parent.VMode.Value == "Down") then
SavedYPosition = SavedYPosition - 3
end
end
elseif (script.Parent.CanFly.Value == "No") then
if (Speed ~= 0) then
Speed = 0
script.Parent.BodyPosition.position = Vector3.new(script.Parent.Position.X, SavedYPosition, script.Parent.Position.Z)
end
end
end
wait(0.1)
end```
Here is the hoverseat script maybe the problem is in this script but im not sure
The problem looks like it might be coming from the weld script but I’m not sure.
if (script.Parent:findFirstChild("BodyPosition") == nil) then
p = Instance.new("BodyPosition")
p.Name = "BodyPosition" -- why are you naming it what it already is?
p.maxForce = Vector3.new(math.huge,math.huge,math.huge)
print(p.position)
p.position = Vector3.new(script.Parent.Position.X, SavedYPosition, script.Parent.Position.Z) --how are you setting Saved&Position?
print(p.position) -- to see the difference before and after the line above
print(script.Parent.Position) -- to see if the position being applied is the same as the parent you are applying it to.
p.Parent = script.Parent
end
if (script.Parent:findFirstChild("BodyGyro") == nil) then
g = Instance.new("BodyGyro")
g.Name = "BodyGyro"
g.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
g.cframe = script.Parent.CFrame
g.Parent = script.Parent
end
Not sure if the script sets the variables with lowercase names, but a lot of names are lowercase (position, maxTorque etc.).
Try printing the items to see what’s being set for the Position of the seat.
I’m guessing the SavedYPosition is being updated to slightly higher than the seat’s actual Position so the ship hovers upwards.
I moved the model that’s stored in the server storage and when I spawn it, it moves to where the model is stored. the model originally was stored above the station.
Yeah, I saw that in the first video…
But did you try ANYTHING I asked about in my previous post?
The notes I added tell you what I’d expect to see in the printed Output, including the SavedYPosition
, which you haven’t explained how it is getting set. If your SavedYPosition
isn’t the same as your spawn Position then the ship will move to that location because the hover script is telling it to.
The prints I added to your script will show up in your Output window and tell you what the values are. If all 3 values don’t equal the same amount it means your ship is going to move…
Here is what the output is saying
13:53:28.888 0, 50, 0 - Server - HoverSeat:16
13:53:28.888 3035.6220703125, 23.800785064697266, -472.844970703125 - Server - HoverSeat:18
13:53:28.888 3035.6220703125, 23.800785064697266, -472.844970703125 - Server - HoverSeat:19
So what is your VMode.Value
set at when the ship spawns? Since nobody is in the hover seat it might be set to up instead of nil.
if (script.Parent:findFirstChild("VMode") ~= nil) then
if (script.Parent.VMode.Value == "Up") then
SavedYPosition = SavedYPosition + 3
elseif (script.Parent.VMode.Value == "Down") then
SavedYPosition = SavedYPosition - 3
end
end
Try anchoring the ship when you spawn it and check the exact CFrame it’s being spawned at, then change where it’s being moved to accordingly.
model:PivotTo()
Is also better. Get used to using and multiplying CFrames,
clonedCar:PivotTo(player.Character.HumanoidRootPart.CFrame * player.Character.HumanoidRootPart.CFrame.LookVector * 15)
I just made a deferent system instead.