Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 06 Sep 2014 02:11 PM |
How can I make this script so when you buy the item your money cant go negative? What it does is Money : 100 Buys money : 0 Buys Money : -100
local a = 1000 local b = 100 local cba = math.random(1,400) local abc = math.random(cba,400) local acb = math.random(abc,400) print(abc) winAfterTurns = acb textures = {"http://www.roblox.com/asset/?id=169795759", "http://www.roblox.com/asset/?id=165024076", "http://www.roblox.com/asset/?id=169795842", "http://www.roblox.com/asset/?id=169795910", "http://www.roblox.com/asset/?id=169795759"}
slots = {script.Parent.Parent.Slot1, script.Parent.Parent.Slot2, script.Parent.Parent.Slot3, script.Parent.Parent.Slot4, script.Parent.Parent.Slot5} local forcewin = 1 debounce = false
for d = 1, 5 do slots[d].Decal.Texture = textures[math.random(1, 5)] end
function checkWin() local same = 1 local winner = false for d = 2, 4 do if (slots[d].Decal.Texture == slots[1].Decal.Texture) then same = same + 1 end end if (same == 4) then winner = true end return winner end
script.Parent.ClickDetector.MouseClick:connect(function() if (debounce == false) then debounce = true game.Players.LocalPlayer.leaderstats.Units.Value = game.Players.LocalPlayer.leaderstats.Units.Value-b b = b +20 a = a +240 for i = 1, 30 do wait(i/100) script.Parent.one:Play() for d = 1, 5 do slots[d].Decal.Texture = textures[math.random(1, 5)] end end if (forcewin == winAfterTurns) then local num = math.random(1, 5) for d = 1, 5 do slots[d].Decal.Texture = textures[num] end forcewin = 1 else forcewin = forcewin + 1 end if (checkWin()) then game.Players.LocalPlayer.leaderstats.Units.Value = game.Players.LocalPlayer.leaderstats.Units.Value+a a = a+50 end debounce = false end end)
while true do wait() script.Parent.Parent.Button.SurfaceGui.TextLabel.Text = "Cost:" .. b .. " Jackpot:" .. a end
|
|
|
| Report Abuse |
|
truman89
|
  |
| Joined: 18 May 2008 |
| Total Posts: 531 |
|
|
| 06 Sep 2014 02:14 PM |
Use the if-then conditional statement where if the money is less than 0, it won't work.
if money < 0 then
Like that |
|
|
| Report Abuse |
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 06 Sep 2014 02:17 PM |
How do i get to the players money? I know its something like game.Players.LocalPlayer.leaderstats.Units.Value |
|
|
| Report Abuse |
|
truman89
|
  |
| Joined: 18 May 2008 |
| Total Posts: 531 |
|
|
| 06 Sep 2014 02:20 PM |
| I can't tell you that. I'd need more information on the script. |
|
|
| Report Abuse |
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 06 Sep 2014 02:29 PM |
It's a slot machign script press a button, random chance of winning. |
|
|
| Report Abuse |
|