So i have a script which is supposed to spawn a car when the event is fired but sometimes it spawns the cars with their wheels on their roofs ( Im using A-Chassis on all cars ) How do i fix this issue? I tried to add a wait(1) timer but then the player can spawn multiple cars at once (Which is not good), so yeah how do i fix this?
The code:
game.ReplicatedStorage:WaitForChild("CheckPrice").OnServerInvoke =
function(player,NameOfCar)
return game.ServerStorage.Cars:FindFirstChild(NameOfCar).Price.Value
end
game.ReplicatedStorage:WaitForChild(“SpawnCar”).OnServerEvent:Connect(function(player,NameOfCar)
player.Character:WaitForChild(“Humanoid”).Sit = false
wait(0.5)
local car = game.Workspace:FindFirstChild(player.Name…"'s Car")
if car then
car:Destroy()
end
local Car = game.ServerStorage.Cars:FindFirstChild(NameOfCar):Clone()
Car:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame)
Car.Name = player.Name.."'s Car"
Car.Parent = workspace
Car:MakeJoints()
Well why it wouldnt? U are setting the CFrame of car to the CFrame of a player. That means if a player is not aligned with track, car wont spawn aligned with track
But sometimes the wheels spawn on the ground like they`re supposed to even if the player is not facing the the direction the car was facing before setting the CFrame, or did i understand your comment the wrong way?
Thankfully it`s doing it less after tweaking the vehicle seat position and orientation. I have also noticed it in other games as well, probably the best solution is to make my own chassis…
Are you using the MoveTo funtion?
Because for a temporary fix you could do Car:MoveTo(game.Players.LocalPlayer.Character.HumanoidRootPart.Position + game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.RightVector * 10)