I Am Trying To Make A Car That When You Press The Respawn Button It Keeps The Car And Respawns It. Currently I Am Struggling With The Button Respawning
model = script.Parent.Parent messageText = ""re. message = Instance.new("Message") message.Text = messageText backup = model:clone() enabled = true function regenerate() wait(3) model = backup:clone() model.Parent = game.Workspace model:makeJoints() message.Parent = nil script.Disabled = true script.Parent.BrickColor = BrickColor.new(26)--Black wait(5) script.Parent.BrickColor = BrickColor.new(104)--Purple script.Disabled = false end function onHit(hit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then regenerate() end end script.Parent.Touched:connect(onHit)
To make a car spawn when a brick is touched, you can do something as simple as the following:
brick = --Instance of part that gets touched here car = --Instance of the model you want to duplicate(I suggest putting it where you want it to spawn, then putting it in server storage and getting it from there) db = false brick.Touched:Connect(function() if db == true then return end db = true car:Clone() wait(10) db = false end)
That can be in a server script anywhere. With further questions/comments/concerns, feel free to reply to my answer. I hope I was able to help! ~mc3334