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: Game money giver!

Previous Thread :: Next Thread 
MarcusTross is not online. MarcusTross
Joined: 30 Aug 2016
Total Posts: 10
19 Sep 2016 07:01 AM
Hey guys in my game, I want to add a thing for players!! It goes like this - in an tycoon, there will be a brick. If a player steps on it,they get 50 cash(currency name = cash). If it is the owner of the tycoon who steps on it,then he won't get the cash. And if a player already collected the cash, then he can't do it again! How can you script this!!!???!!!??

Thanks!
Report Abuse
Mitko0o1 is not online. Mitko0o1
Joined: 30 Nov 2010
Total Posts: 5725
19 Sep 2016 07:31 AM
playersWithCash = {}
cash_ammount = 50
currency = "cash"
--
part = script.Parent

part.Touched:connect(function(hit)
local char = hit.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
if not plr then
char = hit.Parent.Parent -- this means the hit is a hat or a tool
plr = game.Players:GetPlayerFromCharacter(char)
end
if plr then
local playerCollected

for _,v in pairs(playersWithCash) do
if v == plr.Name then
playerCollected = true
break
end
end

if playerCollected == nil then
local leaderstats = plr:WaitForChild("leaderstats")
local myCur = leaderstats:WaitForChild(currency)
myCur.Value = myCur.Value + cash_ammount
end
end

end)
Report Abuse
MarcusTross is not online. MarcusTross
Joined: 30 Aug 2016
Total Posts: 10
19 Sep 2016 07:39 AM
Ty
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