|
| 25 Mar 2017 10:06 PM |
local Gold = Instance.new("IntValue") Gold.Name = "Gold" Gold.Value = PlayerStats[player]["Gold"] Gold.Parent = leaderstats
local MoneyTake = Instance.new("BindableFunction") -- creates the event object MoneyTake.Name = "TakeCash" -- giving a name to the event so we can fire it specifically elsewhere MoneyTake.Parent = script -- puts the event into the Workspace
function MoneyTake.OnInvoke(player, currency) PlayerStats[player]["Gold"] = PlayerStats[player]["Gold"] - currency
end
This works fine with
function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if (humanoid ~= nil) then local player = game.Players:GetPlayerFromCharacter(hit.Parent) game.Workspace.Main.TakeCash:Invoke(player,50) end end
script.Parent.Touched:connect(onTouched)
but How would I go exactly about checking if they have enough and returning Yes/No depending on if they have enough or not |
|
|
| Report Abuse |
|
|
Ben1925
|
  |
| Joined: 07 Apr 2011 |
| Total Posts: 741 |
|
| |
|
|
| 25 Mar 2017 10:13 PM |
| Not that simple, I need to return to whatevers making the cash request yes/no depending on if they have the funds to back it up |
|
|
| Report Abuse |
|
|
Ben1925
|
  |
| Joined: 07 Apr 2011 |
| Total Posts: 741 |
|
| |
|
|
| 27 Mar 2017 03:27 PM |
Did you read, what I asked? Maybe I was too vague.
I have a remote function and everything setup, but I wanna know if its possible that once I send a event to subtract money, to return True/False to the script if they dont have the funds to make the purchase. |
|
|
| Report Abuse |
|
|
|
| 27 Mar 2017 03:29 PM |
| Oops actually nvm I was being stupid theres a way to do this |
|
|
| Report Abuse |
|
|