|
| 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 |
|
|
|
| 22 Jul 2014 04:42 PM |
Could you post the code? We would be glad to help you |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 22 Jul 2014 08:41 PM |
| Next time go to 'Scripting Helpers' next time |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 23 Jul 2014 10:28 AM |
| Be nice to him guys I told him to come here |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 23 Jul 2014 09:11 PM |
Change the last 3 lines to
cd.MouseClick:connect(function(player) regenerate() end) |
|
|
| Report Abuse |
|
|
morash
|
  |
| Joined: 22 May 2010 |
| Total Posts: 5834 |
|
|
| 23 Jul 2014 09:35 PM |
| I thought you were getting out? |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 06:00 PM |
| Thank you Angel, It worked nicely. I'm now leaving hope your satisfied :) |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 06:03 PM |
| Sorry I messed up your name, my eyes have been weaving words together lately. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 07:42 PM |
It's okay Come back whenever you need help |
|
|
| Report Abuse |
|
|
morash
|
  |
| Joined: 22 May 2010 |
| Total Posts: 5834 |
|
|
| 24 Jul 2014 08:44 PM |
| No, don't come back, go to SH. |
|
|
| Report Abuse |
|
|
| |
|