|
| 27 Mar 2015 05:15 PM |
I have this script here. It is inside of a tool in StarterPack. When a Player clicks a Nest Object should appear where they clicked. It does not. Can anyone help me with it? Heres the script.
bin = script.Parent
local N = true
function onButton1Down(mouse) if N == true then N = false
local model = game.ServerStorage.Nest.SNest:Clone() model.Parent = game.Workspace
model:MakeJoints()
model:MoveTo(mouse.Hit)
wait(.1)
bin:Destroy()
end end
function onSelected(mouse) print("Hi") mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
bin.Selected:connect(onSelected)--Any idea what i should use differently?
|
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 05:18 PM |
bin = script.Parent
local N = true
function onButton1Down(mouse) if N == true then N = false
local model = game.ServerStorage.Nest.SNest:Clone() model.Parent = game.Workspace
model:MakeJoints()
model:MoveTo(mouse.Hit.p)
wait(.1)
bin:Destroy()
end end
function onSelected(mouse) print("Hi") mouse.Button1Down:connect(onButton1Down)
end
bin.Selected:connect(onSelected)--Any idea what i should use differently? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 27 Mar 2015 05:26 PM |
This is obviously a duplicate thread which I already reported you for spamming on when you made because you don't appreciate good advice when it was given to you, and I don't appreciate duplicate threads.
However, I'm not getting my hopes up because the mods barely come here.
--
He had the same criticism on how you connected your 'onButton1Down' function.
If you don't actually put forth an effort to make your code better, people are going to suggest the same things over and over. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 05:28 PM |
| I posted his script and tried it out, but it didnt work thats why i bumped. And look at the other post and this one. Ive made it easier to read, and added ServerStorage. And sadly no i dont know how to do a better alternative to HopperBin. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 05:30 PM |
| I Also did use his script, by adding the Button1Down, but it didnt work :(. Thats why i bumped it again. |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 27 Mar 2015 05:33 PM |
local hopperbin = script.Parent local debounce = true
hopperbin.Selected:connect(function(mouse) print("Hi") mouse.Button1Down:connect(function() if debounce then debounce = false local model = game.ServerStorage.Nest.SNest:Clone() model.Parent = game.Workspace model:MakeJoints() model:MoveTo(mouse.Hit) wait(.1) hopperbin:Destroy() end end) end)
|
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 27 Mar 2015 05:34 PM |
THAT
is how you make a script easier to read for ACTUAL SCRIPTERS |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 05:37 PM |
Thank you :D
But an error showed up :
18:36:54.146 - Unable to cast CoordinateFrame to Vector3 18:36:54.147 - Script 'Players.Player.Backpack.[S]Nest.Insert', Line 12 18:36:54.147 - Stack End |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 27 Mar 2015 05:39 PM |
local hopperbin = script.Parent local debounce = true
hopperbin.Selected:connect(function(mouse) print("Hi") mouse.Button1Down:connect(function() if debounce then debounce = false local model = game.ServerStorage.Nest.SNest:Clone() model.Parent = game.Workspace model:MakeJoints() model:MoveTo(mouse.Hit.p) wait(.1) hopperbin:Destroy() end end) end) |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 05:43 PM |
| It worked in test Mode, But for some reason, It broke when i Entered the Server. No errors showed up in Output. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 05:45 PM |
Make it a LocalScript. Usually does the trick.
#໓นrŞt (RAP:86 - R$143 - Tx241) [British. Tea slurper. -slurps tea-] |
|
|
| Report Abuse |
|
|
| |
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 27 Mar 2015 05:51 PM |
| Is FilteringEnabled on? You can find it under properties in Workspace. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2015 05:52 PM |
| Its not on, is it because its using LocalPlayer Somewhere? |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Mar 2015 06:33 PM |
What exactly is line 12?
Sure, you showed us what the output is, but we don't know which line the error occurs in. |
|
|
| Report Abuse |
|
|