|
I want to make it so my respawn pad doesn't make another copy of the vehicle without removing the old one. Those anyone have a script I can add that makes it so vehicles get deleted when I press a button? Please help
The script I use:
--Edited by Jesus--
model = script.Parent.Parent
messageText = "Regenerating the Object"
message = Instance.new("Hint")message.Text = messageText
backup = model:clone()
enabled = true
function regenerate()
message.Parent = game.Workspace
model:clone()
wait(2)--Change this number for the time in seconds it will take to regen your model.
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()
message.Parent = nil
script.Disabled = true
script.Parent.BrickColor = ("Black") -- Change "Black" for the exact name of the color you want, the name can be found at any brick's Properties, just click the BrickColor tab and select the one you want.
wait(5)--Change this number for the time in seconds it will take between regenerations.
script.Parent.BrickColor = ("Bright violet") -- Change "Bright violet" for the exact name of the color you want, the name can be found at any brick's Properties, just click the BrickColor tab and select the one you want.
script.Disabled = false
end
script.Parent.ClickDetector.MouseClick:connect(regenerate) |
|
|
|
If you help I'll add you in my game description. |
|
025110Join Date: 2012-11-23 Post Count: 57661 |
model = script.Parent.Parent
local backup = game.Lighting.Car:clone() --PUT THE MODEL IN LIGHTING NAMED "Car"
local db = false
script.Parent.ClickDetector.MouseClick:connect(function()
if not db then
db = true
end
local h = Instance.new("Hint").Text = "Regenerating the object.."
wait(1)
h:Destroy()
local new = backup:Clone().Parent = workspace
new:makeJoints()
new.CFrame = CFrame.new(1,1,1)
script.Parent.BrickColor = BrickColor.new("Lime gren")
wait(2)
script.Parent.BrickColor = BrickColor.new("Really Red")
db = false
end)
|
|
025110Join Date: 2012-11-23 Post Count: 57661 |
--OOPS, DIDNT READ
model = script.Parent.Parent
local backup = game.Lighting.Car:clone() --PUT THE MODEL IN LIGHTING NAMED "Car"
local db = false
script.Parent.ClickDetector.MouseClick:connect(function()
if not db then
db = true
end
local h = Instance.new("Hint").Text = "Regenerating the object.."
wait(1)
h:Destroy()
workspace:FindFirstChild("OldCarName"):Destroy()
local new = backup:Clone().Parent = workspace
new:makeJoints()
new.CFrame = CFrame.new(1,1,1)
script.Parent.BrickColor = BrickColor.new("Lime gren")
wait(2)
script.Parent.BrickColor = BrickColor.new("Really Red")
db = false
end)
|
|
|
|
nvm the script didnt work because if I placed the car into light it wouldn't be in the terrain |
|
|
i meant to say it doesnt work, i put a copy in lighting and it didnt work |
|
|
maybe it isnt connected to a click detector or something |
|
025110Join Date: 2012-11-23 Post Count: 57661 |
--I see errors, try this
-- name the car "car"
model = script.Parent.Parent
local backup = game.Lighting.Car:clone() --PUT THE MODEL IN LIGHTING NAMED "Car"
local db = false
script.Parent.ClickDetector.MouseClick:connect(function()
if not db then
db = true
end
local h = Instance.new("Hint").Text = "Regenerating the object.."
wait(1)
h:Destroy()
workspace:FindFirstChild("Car"):Destroy()
local new = backup:Clone().Parent = workspace
new:MakeJoints()
new:MoveTo(1,1,1)
script.Parent.BrickColor = BrickColor.new("Lime green")
wait(2)
script.Parent.BrickColor = BrickColor.new("Really Red")
db = false
end)
|
|
|
local h = Instance.new("Hint").Text = "Regenerating the object.." That line had a red line under the =? Btw the script still didn't work ;~; |
|
slxrJoin Date: 2012-01-27 Post Count: 1075 |
local h = Instance.new("Hint")
h.Text = "Regenerating the object.."
kthxbye |
|
|
Nope, *sigh* still didn't work :( |
|