Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 04:58 PM |
location = script.Parent.Parent.Parent.Parent.Parent.Vehicle save = regen:clone()
function onClick() back = save:clone() back.Parent = location back:MakeJoints() end
script.Parent.MouseButton1Down:connect(onClick)
Trying to use a surfacegui as a regen button. |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 05:04 PM |
oops i messed up on line 2 didn't say what regen was but still doesn't work
does anyone have a more efficient regen script i could use for regenerating a model with a gui? |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 05:06 PM |
Fixed it!
---------------------------------- location = game.Workspace regen = game.Workspace.Vehicle save = regen:Clone()
function onClick() back = save:Clone() back.Parent = location back:MakeJoints() end
script.Parent.MouseButton1Down:connect(onClick) ---------------------------------- |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 05:09 PM |
I'd like it to remove the old model before regenerating it EACH time ----------------------- location = game.Workspace regen = game.Workspace.Vehicle save = regen:Clone()
function onClick() regen:Remove() back = save:Clone() back.Parent = location back:MakeJoints() end
script.Parent.MouseButton1Down:connect(onClick) ----------------------- It works the first time I regenerate it, but if I regenerate it again, it allows you to spam the regen button and insert infinite vehicles |
|
|
| Report Abuse |
|
|
Juniperr
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 6094 |
|
|
| 29 May 2014 05:12 PM |
| Mind if I ask why you have not placed a copy in the lighting and copied it from there? It's much easier than copying a current model from the workspace. |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
| |
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 05:14 PM |
doesn't let you put models inside lighting anymore apparently gonna do serverstorage. |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 05:21 PM |
Why doesn't this work? ------------------------------------------ location = game.Workspace regen = game.ServerStorage.Vehicle save = regen:Clone()
function onClick() if game.Workspace.Vehicle==true then game.Workspace.Vehicle:Remove() else back = save:Clone() back.Parent = location back:MakeJoints() end end script.Parent.MouseButton1Down:connect(onClick) ------------------------------------------
line 6: Vehicle is not a valid member of Workspace uh that's kinda why i asked if it was true before doing it silly output someone help me on this? i'm definitely not the best scripter |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
| |
|
Amexurous
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 324 |
|
| |
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 05:30 PM |
amex i bet you i sound stupid for asking this but am i FindFirstChild right
the "if v2 then" line seems very silly but i figured it might work it didn't
------------------------------------------ location = game.Workspace regen = game.ServerStorage.Vehicle save = regen:Clone() v2=game.Workspace:FindFirstChild("Vehicle")
function onClick() if v2 then v2:Remove() back = save:Clone() back.Parent = location back:MakeJoints() end end
script.Parent.MouseButton1Down:connect(onClick) |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 05:35 PM |
this also did not work:
location = game.Workspace regen = game.ServerStorage.Vehicle save = regen:Clone() v2=game.Workspace:FindFirstChild("Vehicle")
function onClick() if v2 ~= nil then v2:Remove() back = save:Clone() back.Parent = location back:MakeJoints() end end
script.Parent.MouseButton1Down:connect(onClick) |
|
|
| Report Abuse |
|
|
Amexurous
|
  |
| Joined: 28 Jan 2014 |
| Total Posts: 324 |
|
|
| 29 May 2014 05:39 PM |
is it because if there is no vehicle in workspace it wont fire?
location = game.Workspace regen = game.ServerStorage.Vehicle save = regen:Clone() v2=game.Workspace:FindFirstChild("Vehicle")
function onClick() if v2 ~= nil then v2:Remove() back = save:Clone() back.Parent = location back:MakeJoints() else back = save:Clone() back.Parent = location back:MakeJoints( end end
script.Parent.MouseButton1Down:connect(onClick)
|
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 05:46 PM |
it spawns the model from serverstorage but it spawns with broken joints and you can spawn it infinite times |
|
|
| Report Abuse |
|
|
Juniperr
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 6094 |
|
|
| 29 May 2014 06:01 PM |
just try this one: regen = game.ServerStorage.Vehicle:Clone() v2=game.Workspace:FindFirstChild("Vehicle")
local HopB = script.Parent local function Sel(ms) local function click() if v2 then v2:Destroy() regen.Parent = Workspace else end end ms.Button1Down:connect(click) end HopB.Selected:connect(Sel)
|
|
|
| Report Abuse |
|
|
Juniperr
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 6094 |
|
|
| 29 May 2014 06:04 PM |
Wait, added joints too
regen = game.ServerStorage.RC:Clone() v2=game.Workspace:FindFirstChild("Vehicle")
local HopB = script.Parent local function Sel(ms) local function click() if v2 then v2:Destroy() regen.Parent = Workspace Workspace.Vehicle:MakeJoints() else end end ms.Button1Down:connect(click) end HopB.Selected:connect(Sel)
|
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 06:04 PM |
| Workspace.Model.Board.SurfaceGui.Frame.TextButton.regen:16: attempt to index field 'Selected' (a boolean value) |
|
|
| Report Abuse |
|
|
Juniperr
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 6094 |
|
|
| 29 May 2014 06:07 PM |
| Wait, this is for a gui? The script I entered is for a hopperbin. You might have to edit it a little. |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 06:08 PM |
yeah, lol I should of just used a ClickDetector and a basic regen script would of done it easy, instead of using a stupid surfacegui |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 29 May 2014 06:27 PM |
tried with ClickDetectors instead doesn't spawn vehicle and says "ClickDetector" is not a valid member of workspace -------------------------------- model = game.ServerStorage.Vehicle new = model:clone() enabled = true
function onClicked() if enabled then enabled = false wait(0.3) if game.Workspace.Vehicle~=nil then game.Workspace.Vehicle:Remove() end model = new:clone() model.Parent = game.Workspace model:MakeJoints() wait(5) enabled = true end end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|