|
| 03 Apr 2016 07:23 AM |
model = game.Workspace.zip messageText = ""
message = Instance.new("Message") message.Text = messageText backup = model:clone() enabled = true
function regenerate() message.Parent = game.Workspace model:remove()
wait(0)
model = backup:clone() model.Parent = game.Workspace model:makeJoints() message.Parent = nil script.Disabled = true script.Parent.BrickColor = BrickColor.new(26) wait(20) script.Disabled = false script.Parent.BrickColor = BrickColor.new(104) end
function onHit(hit) if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then regenerate() end end
script.Parent.Touched:connect(onHit)
--
i dont know where i putted something wrong? the regen works at start when you touch it but after it it doesnt work anymore, anyone has a solution?
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
Mike_N
|
  |
| Joined: 25 Feb 2016 |
| Total Posts: 150 |
|
|
| 03 Apr 2016 07:30 AM |
Probably because you never set the clone to a parent so when it does the first part, it deletes the first model and the clone of that model because you never set the clone to a parent so it thinks it's the same model.
backup = model:Clone().Parent = game.Lighting
|
|
|
| Report Abuse |
|
|
Mike_N
|
  |
| Joined: 25 Feb 2016 |
| Total Posts: 150 |
|
|
| 03 Apr 2016 07:47 AM |
Not lighting, sorry.
Guess I didn't explain that correctly.
But say you have one cookie on the counter, and you clone it and it goes on the same counter. You want Cookie1 to be eaten by... whoever but if they're on the same counter the person doesn't know which one is Cookie1.
Same goes in this case, you're cloning the backup however you're not setting it to a parent so it's just going to go with the regular model you used at the start so it's just essentially going to follow it. Also, use a position when cloning these models so they know where to go.
backup:MoveTo(--insert vector3 position)
|
|
|
| Report Abuse |
|
|
Mike_N
|
  |
| Joined: 25 Feb 2016 |
| Total Posts: 150 |
|
|
| 03 Apr 2016 07:50 AM |
Found this in free models, works fine. Just take a part, put this script in. Then take your car or whatever and group the button and the car.
model = script.Parent.Parent--Indicates that the script interacts with the model the button is grouped with. messageText = ""--If you want a message to appear upon pressing, type it here.
message = Instance.new("Message") message.Text = messageText backup = model:clone() enabled = true
function regenerate() message.Parent = game.Workspace model:remove()
wait(2)--Change this number to display the regen message as long as you want in seconds.
model = backup:clone() model.Parent = game.Workspace model:makeJoints() message.Parent = nil
script.Disabled = true script.Parent.BrickColor = BrickColor.new(26)--Black wait(10)--Change this number to change the time in between regenerations via the button, in seconds.. 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)
|
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 07:56 AM |
I found an solution, i made it so it removed the regen button and then it clones it again from lighting
|
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 07:56 AM |
But still thanks for your help
|
|
|
| Report Abuse |
|
|
tomytom2
|
  |
| Joined: 17 Sep 2012 |
| Total Posts: 364 |
|
|
| 03 Apr 2016 07:58 AM |
| Need help with A Regen button? Rofl. R U being srs or is this a April fools? |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 08:00 AM |
i'm late but.. you got fooled m8
|
|
|
| Report Abuse |
|
|
tomytom2
|
  |
| Joined: 17 Sep 2012 |
| Total Posts: 364 |
|
|
| 03 Apr 2016 08:02 AM |
#KnewIt :D
See I'm a boss at life. Hey I saw your chuck'e cheese game its built well. I Got a great development idea. Accept my friend request then party me. |
|
|
| Report Abuse |
|
|