generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Regenerating

Previous Thread :: Next Thread 
FancyPig19 is not online. FancyPig19
Joined: 23 Sep 2014
Total Posts: 269
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
FancyPig19 is not online. FancyPig19
Joined: 23 Sep 2014
Total Posts: 269
19 Mar 2016 07:55 AM
My bad. The THIRD if.
Report Abuse
FancyPig19 is not online. FancyPig19
Joined: 23 Sep 2014
Total Posts: 269
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
FancyPig19 is not online. FancyPig19
Joined: 23 Sep 2014
Total Posts: 269
20 Mar 2016 10:56 AM
Bump
Report Abuse
FancyPig19 is not online. FancyPig19
Joined: 23 Sep 2014
Total Posts: 269
21 Mar 2016 03:34 PM
Bump
Report Abuse
Xstarlight is not online. Xstarlight
Joined: 18 Oct 2012
Total Posts: 870
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
FancyPig19 is not online. FancyPig19
Joined: 23 Sep 2014
Total Posts: 269
21 Mar 2016 04:01 PM
Any other suggestions?
Report Abuse
FancyPig19 is not online. FancyPig19
Joined: 23 Sep 2014
Total Posts: 269
22 Mar 2016 02:35 PM
Bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image