Can anyone help me on a car spawning system? The system should spawn cars witch are located in the server storage. I would need it for an upcoming racing game. Thanks a lot
Picture for example from sports car simulator
Do you want this in a GUI?
Do you want a menu of available cars that the player has already ‘purchased’?
You need to be a little more specific about what you require, or you’re just going to get a free on-touch regen pad button from free models.
Well, if assuming the Spawn Gui button is the car spawn button then this is what you will want to do.
(Setting up)
First, Put a localscript into the spawn button, then add a remotefunction in ReplicatedStorage and then NAME the remotefunction “Car1” after that put a normal script in ServerScriptService lastly put a part named Car1TP where ever you want the car to spawn in Workspace (MAKE SURE ITS ANCHORED AND INCOLLIDABLE).
(Localscript Scripting)
Second open up the localscript in the spawn gui button and put this:
script.Parent.MouseButton1Click:Connect(function(plr)
game.ReplicatedStorage.Car1:FireServer(plr)
end)
(ServerScriptService Scripting)
Third open up the normal script in ServerScriptService and put this:
game.ReplicatedStorage.Car1.OnServerEvent:Connect(function(plr)
local clone = game.ServerStorage.CARNAMEHERE---------- replace CARNAMEHERE with the name of the car in ServerStorage
clone.Parent = workspace
clone:MoveTo(workspace.Car1TP.Position)
– and ya done
end)
Lastly, I hope this helped if you have any questions please ask!
Ok Thanks alot. I will try my best.
i think its
local clone = game.ServerStorage.CarNameHere:Clone()
clone.Parent = Workspace
Clone.Position = Car1TP.Position
end)
I have a working system now so yea