I tried to make a car spawner for my drifting game but I'm facing a problem. The car doesn't clone in ReplicatedStorage. I'm also using a remote event.
--local script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local button = script.Parent
local shopframe = script.Parent.Parent
local designframe = shopframe.Parent.ShopFrame
local openbutton = shopframe.Parent.OpenShop
local event = ReplicatedStorage.Events.SpawnCar
local cars = ReplicatedStorage.Cars
button.MouseButton1Click:Connect(function()
cars.Nissan350z:Clone()
wait(0.1) --//makes sure it clones before firing the server
event:FireServer(cars.Nissan350z)
shopframe.Visible = false
designframe.Visible = false
openbutton.Text = "Open Shop"
end)
--server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage.Events.SpawnCar
event.OnServerEvent:Connect(function(player, car)
car.Parent = game.Workspace
end)

1 comment
Thank you, it worked perfectly!