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 » Scripting Helpers
Home Search
 

Re: Ok, this is really hard to explain...

Previous Thread :: Next Thread 
VividNeon is not online. VividNeon
Joined: 24 Apr 2012
Total Posts: 1607
23 Jul 2014 06:21 AM
But I'm trying to award players with coins, wins, and Player Points on a win (when they touch a button). However, it gives multiple of each to them whenever they win. How can I fix this? This is what I have now:

button.Touched:connect(function(part)
debounce = false
if not debounce then
debounce =true
local playa=game.Players:FindFirstChild(part.Parent.Name);
if playa and playa.isIn.Value then
if #_G.stats==0 then
playa:SaveNumber("wins",playa:LoadNumber("wins")+1);
playa.leaderstats.Wins.Value=playa:LoadNumber("wins");
if game:GetService("GamePassService"):PlayerHasPass(playa,167871575) then
playa.leaderstats.Coins.Value=playa.leaderstats.Coins.Value+200
else
playa.leaderstats.Coins.Value=playa.leaderstats.Coins.Value+100
end
playa.EXP.Value=playa.EXP.Value+50
if game:GetService("GamePassService"):PlayerHasPass(playa,167871800) then
pts:AwardPoints(playa.userId,1)
else
pts:AwardPoints(playa.userId,70)
pts:AwardPoints(26097803,30)
end
end
table.insert(_G.stats,{name=playa.Name,k=tick()-startTime,team=BrickColor.new("Bright blue")});
playa.leaderstats.Pos.Value=numberDisp(#_G.stats);
playa.isIn.Value=false;
playa.TeamColor=waiting.TeamColor;
playa.Character.Torso.CFrame = Workspace.Floor.CFrame--(0,6,0)
debounce=false
end
end
end)
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
23 Jul 2014 06:26 AM
@Second line


remove the "debounce = false" line.
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
23 Jul 2014 07:29 AM
put debounce = false on line 1
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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