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
 

Scripting a Regen Button *Problem*

Previous Thread :: Next Thread 
masterchief7043 is not online. masterchief7043
Joined: 11 Sep 2009
Total Posts: 111
22 Jul 2014 04:34 PM
I have tried to make a basic Button to regen a model, I tried using a Wiki but When i regen the model I do not want a message displayed and also I do not want the model to delete it self and redesplay back into the workplace.

I'm using this regen button to regenerate plane models for plane warefare.

Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
22 Jul 2014 04:42 PM
Could you post the code?
We would be glad to help you
Report Abuse
masterchief7043 is not online. masterchief7043
Joined: 11 Sep 2009
Total Posts: 111
22 Jul 2014 04:42 PM
Bump
Report Abuse
masterchief7043 is not online. masterchief7043
Joined: 11 Sep 2009
Total Posts: 111
22 Jul 2014 04:46 PM
Sorry for the bump, that was unneeded. But I'm using 1 set of code that I found. Also Is there a way i can implement a specific code that allows a Humanoids to click on the brick instead of walking over it to prevent accidental spawning and lagging the server?

Wiki Code:



local model = game.Workspace.MyModelName

local message = Instance.new("Message")
message.Text = "Regenerating "..model.Name
local backup = model:clone()
local regenerating = false

function regenerate()
--Don't regenerate again if we're already doing it!
if regenerating then
return
else
regenerating = true
end

model:Destroy()

-- Display the regen message for 4 seconds
message.Parent = game.Workspace
wait(4)
message.Parent = nil

-- Put the copied model back into workspace
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()

-- After 30 seconds, allow the model to be regenerated again
wait(30)
regenerating = false
end

--Connect a function that regenerates the model when a player touches the button
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
regenerate()
end
end)


Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
22 Jul 2014 04:51 PM
Try this

local model = game.Workspace.MyModelName
local cd = Instance.new("ClickDetector", script.Parent)

local backup = model:clone()
local regenerating = false

function regenerate()
--Don't regenerate again if we're already doing it!
if regenerating then
return
else
regenerating = true
end

-- Put the copied model back into workspace
model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()

-- After 30 seconds, allow the model to be regenerated again
wait(30)
regenerating = false
end

--Connect a function that regenerates the model when a player touches the button
script.Parent.MouseClick:connect(function(player)
regenerate()
end)
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
22 Jul 2014 08:41 PM
Next time go to 'Scripting Helpers' next time
Report Abuse
masterchief7043 is not online. masterchief7043
Joined: 11 Sep 2009
Total Posts: 111
23 Jul 2014 05:58 AM
@Crow thats understandable, but when I tried making a reply it kept saying someone was trying to access my account then when i refreshed it asked for my user.name and pass.word. So I'm stuck here

And thanks I have to try it out later I have to go.
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
23 Jul 2014 06:06 AM
goto scripting helpers

please

we don't care about your problems

we only want you gone
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
23 Jul 2014 10:28 AM
Be nice to him guys I told him to come here
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
23 Jul 2014 11:07 AM
Well I'm telling you both to get out.
Report Abuse
masterchief7043 is not online. masterchief7043
Joined: 11 Sep 2009
Total Posts: 111
23 Jul 2014 07:27 PM
@DigPoe, thats very rude. We can be a gentle men about this after I test out the regen button I'll leave ok?
Report Abuse
masterchief7043 is not online. masterchief7043
Joined: 11 Sep 2009
Total Posts: 111
23 Jul 2014 07:57 PM
Seems that when I replaced *MyModelsName* with the models name and do not group the regen button with the model; the model does not regen but the button has the capability of being regened by clicking the brick. When I regen the model, I cannot click the brick so no regen.

Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
23 Jul 2014 09:11 PM
Change the last 3 lines to

cd.MouseClick:connect(function(player)
regenerate()
end)
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
23 Jul 2014 09:35 PM
I thought you were getting out?
Report Abuse
masterchief7043 is not online. masterchief7043
Joined: 11 Sep 2009
Total Posts: 111
24 Jul 2014 06:00 PM
Thank you Angel, It worked nicely. I'm now leaving hope your satisfied :)
Report Abuse
masterchief7043 is not online. masterchief7043
Joined: 11 Sep 2009
Total Posts: 111
24 Jul 2014 06:03 PM
Sorry I messed up your name, my eyes have been weaving words together lately.
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
24 Jul 2014 07:42 PM
It's okay
Come back whenever you need help
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
24 Jul 2014 08:44 PM
No, don't come back, go to SH.
Report Abuse
yoyomynameisjoe66 is not online. yoyomynameisjoe66
Joined: 26 Jul 2009
Total Posts: 1068
24 Jul 2014 09:59 PM
-___- z
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