Slateon
|
  |
| Joined: 30 Jul 2011 |
| Total Posts: 13 |
|
|
| 08 Aug 2016 05:34 PM |
Hi, I've been having problems with a clickdector to equip the players that click this block a tool. Its based off of the prison life equipping mechanics (click on gun, gun disappears, gun equips, gun appears back in the same place) So far I have:
local function onClicked() script.Parent.Union.Transparency = 1 script.Parent.Part.Transparency = 1 game.Lighting.drink.clone() = Player.Backpack wait(15) script.Parent.Union.Transparency = 0 script.Parent.Part.Transparency = 0 end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Please help, this is my first REAL experience programming/scripting. |
|
|
| Report Abuse |
|
|
peIicans
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 1148 |
|
|
| 08 Aug 2016 05:55 PM |
regular script
local function onClicked(plr)
script.Parent.Union.Transparency = 1 script.Parent.Part.Transparency = 1 game.Lighting.drink.clone() = plr.Backpack wait(15) script.Parent.Union.Transparency = 0 script.Parent.Part.Transparency = 0
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
|
|
| Report Abuse |
|
|
Slateon
|
  |
| Joined: 30 Jul 2011 |
| Total Posts: 13 |
|
|
| 08 Aug 2016 06:56 PM |
| Thank you so much! Gladly appreciate the help. :D |
|
|
| Report Abuse |
|
|
Slateon
|
  |
| Joined: 30 Jul 2011 |
| Total Posts: 13 |
|
|
| 08 Aug 2016 07:03 PM |
| @pelicans, I tested it and still does not work, any other suggestions? |
|
|
| Report Abuse |
|
|
peIicans
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 1148 |
|
| |
|
Slateon
|
  |
| Joined: 30 Jul 2011 |
| Total Posts: 13 |
|
|
| 08 Aug 2016 07:38 PM |
I didn't receive the tool. Output bar says:
Workspace.Model.Script:5: unexpected symbol near '=' |
|
|
| Report Abuse |
|
|
peIicans
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 1148 |
|
|
| 08 Aug 2016 07:43 PM |
wow didnt c that error
this game.Lighting.drink.clone() = plr.Backpack
should be
game.Lighting.drink:Clone().Parent = plr.Backpack
|
|
|
| Report Abuse |
|
|
Slateon
|
  |
| Joined: 30 Jul 2011 |
| Total Posts: 13 |
|
|
| 08 Aug 2016 07:45 PM |
| YESSSS! Finally worked, thank you so much! By any chance could you explain to me why you had to add parent to the end of clone? as well as a colon? |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2016 07:48 PM |
game.Lighting.drink:Clone().Parent = plr.Backpack
he added parent because he is parenting the cloned object to the player's backpack
and he added a colon because it's :Clone() not .Clone() |
|
|
| Report Abuse |
|
|
Slateon
|
  |
| Joined: 30 Jul 2011 |
| Total Posts: 13 |
|
|
| 08 Aug 2016 07:50 PM |
| Thanks for explaining that to me, really helped :D |
|
|
| Report Abuse |
|
|