|
| 01 Dec 2013 07:24 PM |
x = script.Parent
function mouseclick(click) local c = click.Parent:FindFirstChild('Humanoid') if c then gems = c.Parent:FindFirstChild('Gems') gems = Gems.Value + 1 end end
x.MouseButton1Click:connect(click)
I want it so that when the gui button is pressed, you gain 1 gem. |
|
|
| Report Abuse |
|
|
BetterBe
|
  |
| Joined: 25 Jan 2009 |
| Total Posts: 1034 |
|
|
| 01 Dec 2013 07:27 PM |
plr = game.Players.LocalPlayer plrCharacter = plr.Character
x = script.Parent
function mouseclick(click) local c = plrCharacter:FindFirstChild('Humanoid') if c then gems = plrCharacter:FindFirstChild('Gems') gems = Gems.Value + 1 else end end
x.MouseButton1Click:connect(click)
--use this in a localscript in the button (same result, only fixed) --also assuming there is 'Gems' inside the player. |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 01 Dec 2013 07:28 PM |
x = script.Parent
function mouseclick(click) local c = click.Parent:FindFirstChild('Humanoid') if c then gems = c.Parent:FindFirstChild('Gems') gems = Gems.Value + 1 end end
x.MouseButton1Click:connect(mouseclick)
I want it so that when the gui button is pressed, you gain 1 gem.
|
|
|
| Report Abuse |
|
|
|
| 01 Dec 2013 07:37 PM |
Still won't work. Here is the leaderboard.
game.Players.PlayerAdded:connect(function(plr) local w = Instance.new('IntValue', plr) w.Name = 'leaderstats' local x = Instance.new('IntValue', w) x.Name = 'Gems' x.Value = 0 local y = Instance.new('IntValue', w) y.Name = 'Cash' y.Value = 0 while true do wait(10) y.Value = y.Value + 5 end end)
And the gui is structured like this:
StarterGui >ScreenGui >>TextButton(gemclicker) >>>Localscipt(addgems)
Inside the script:
plr = game.Players.LocalPlayer plrCharacter = plr.Character
x = script.Parent
function mouseclick(click) local c = plrCharacter:FindFirstChild('Humanoid') if c then gems = plrCharacter:FindFirstChild('Gems') gems = Gems.Value + 1 else end end
x.MouseButton1Click:connect(click) |
|
|
| Report Abuse |
|
|