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: Gold/Buying Questions

Previous Thread :: Next Thread 
skppiy4000 is online. skppiy4000
Joined: 09 Oct 2008
Total Posts: 1945
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 is not online. Ben1925
Joined: 07 Apr 2011
Total Posts: 741
25 Mar 2017 10:11 PM
An if statement...??
Report Abuse
skppiy4000 is online. skppiy4000
Joined: 09 Oct 2008
Total Posts: 1945
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 is not online. Ben1925
Joined: 07 Apr 2011
Total Posts: 741
25 Mar 2017 11:48 PM
Remote function maybe?
Report Abuse
skppiy4000 is online. skppiy4000
Joined: 09 Oct 2008
Total Posts: 1945
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
skppiy4000 is online. skppiy4000
Joined: 09 Oct 2008
Total Posts: 1945
27 Mar 2017 03:29 PM
Oops actually nvm I was being stupid theres a way to do this
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