Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 15 Apr 2015 04:52 PM |
Hello again, what do I do to make it so if the value is greater than 200, not only is the item rewarded but the points are lost?
local Equip = script.Parent.Parent.Parent.Parent:WaitForChild("EquipGui") local Player = game.Players.LocalPlayer local Points = game.Players.LocalPlayer.leaderstats.Jis.Value
function onButtonClicked() local stats = Player:FindFirstChild("leaderstats") if stats then if stats.Jis.Value >= 200 then Equip.Rocket.Visible = true script.Parent.Text = "Bought!" wait (1) script.Parent.Text = "Item owned." script.Parent.Style = "RobloxRoundButton" script.Disabled = true elseif Points < 20 then script.Parent.Text = "You do not have enough points to buy this item!" wait (1) script.Parent.Text = "Buy." end end end
script.Parent.MouseButton1Click:connect(onButtonClicked) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 15 Apr 2015 04:53 PM |
| stats.Jis.Value = stats.Jis.Value - 200 |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 15 Apr 2015 04:55 PM |
@Time I actually already tried that. Is this wrong?
local Equip = script.Parent.Parent.Parent.Parent:WaitForChild("EquipGui") local Player = game.Players.LocalPlayer local Points = game.Players.LocalPlayer.leaderstats.Jis.Value local BoughtPoints = game.Players.LocalPlayer.leaderstats.Jis.Value-200
function onButtonClicked() local stats = Player:FindFirstChild("leaderstats") if stats then if stats.Jis.Value >= 200 then Points = BoughtPoints Equip.Rocket.Visible = true script.Parent.Text = "Bought!" wait (1) script.Parent.Text = "Item owned." script.Parent.Style = "RobloxRoundButton" script.Disabled = true elseif Points < 20 then script.Parent.Text = "You do not have enough points to buy this item!" wait (1) script.Parent.Text = "Buy." end end end
script.Parent.MouseButton1Click:connect(onButtonClicked) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 15 Apr 2015 04:58 PM |
I think that can work but I like this better:
if stats.Jis.Value >= 200 then Equip.Rocket.Visible = true script.Parent.Text = "Bought!" stats.Jis.Value = stats.Jis.Value - 1 wait (1) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|