Answered by
8 years ago Edited 8 years ago
02 | local scr = script.Parent |
03 | if scr.Parent.Name = = "Backpack" then |
04 | local amount = math.random( 10 , 100 ) |
05 | local player = scr.Parent.Parent |
06 | while player.Character = = nil do |
07 | print ( "NO CHARACTER" ) |
12 | if player.Money.Value > = amount then |
13 | player.Money.Value = player.Money.Value - amount |
14 | script.Parent.BillboardGui.TextLabel.Text = amount |
16 | j.Position = player.Character.Torso.Position |
17 | j.Parent = game.Workspace |
18 | print ( "Money Dropped" ) |
21 | player.Character.Humanoid.Died:connect(onDied) |
25 | function onTouch(part) |
26 | local p = game.Players:playerFromCharacter(part.Parent) |
27 | if p = = nil then return end |
28 | if not enabled then return end |
31 | p.Money.Value = p.Money.Value + amount |
35 | scr.Touched:connect(onTouch) |
I put both the if statement and the script.Parent.BillboardGui.TextLabel.Text = amount
into the if statement. I've dealt with this kind of stuff before, and I remember it calling different numbers each function/if statement. Hopefully this works. I don't really have an explanation for why I did what I did, because in my mind, it works out perfectly, but I can't really put it into words.