generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How do I make it so you lose the points after buying?

Previous Thread :: Next Thread 
Klink45 is not online. 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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
15 Apr 2015 04:53 PM
stats.Jis.Value = stats.Jis.Value - 200
Report Abuse
Klink45 is not online. 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 is not online. 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 is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
15 Apr 2015 04:59 PM
- 200*
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image