|
| 19 Mar 2016 07:54 AM |
So I'm making tools that you can pick up through dialog and then destroy themselves.But I need the dialog giver to regen after it's destroyed. My first problem is that it doesn't put itself into debris. This is the give through dialog script that I am using:
script.Parent.DialogChoiceSelected:connect(function(player, choice) if (choice == script.Parent.Choice1) then -- if (player.Backpack:findFirstChild("Beretta")==nil) then pistol = game.ServerStorage["QBB-95 LSW"]:clone() pistol.Parent = player.Backpack game:GetService("Debris"):AddItem(script.Parent.Parent.Parent) -- end end if (choice == script.Parent.Choice2) then -- if (player.Backpack:findFirstChild("Beretta")==nil) then pistol = game.ServerStorage["Wooden Planks"]:clone() pistol.Parent = player.Backpack -- end end end)
Ignore the second part after the second "if" as I am not using that part. Does anyone know how to fix this?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 19 Mar 2016 08:17 AM |
Okay, just solved that problem by adding a time the the debris. So now to problem B. After the model goes to debris, it doesn't regenerate. Here's my script:
local regenTime = 15 -- Time You Want It To Regen local messageTime = 0 -- Time You Want The Message To Pop Up When Done
local model = script.Parent local message = Instance.new("Message")
--Check that the script hasn't been placed in workspace if model ~= game.Debris then message.Text = "Regenerating " .. model.Name
local backup = model:clone() -- Make the backup
while true do wait(regenTime)
--Copy the backup model = backup:clone() model.Parent = game.Debris model:makeJoints() end else error("Nothing to regenerate!") -- This Happens When You Dont Put This In Your Model end
Also, ignore the message part. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 21 Mar 2016 03:39 PM |
| Well the first thing is that you delete the model (Probably, the script is difficult to understand) AND the script since the script is in the model. It would probably be easier to have a base model for the gun, then make the clone for that gun and then make the clones parent be the character who chose the dialog to be its parent. Also take the script out of the model so as to not delete it if you must delete the model. |
|
|
| Report Abuse |
|
|
| |
|
| |
|