|
| 20 Apr 2013 08:14 AM |
So, I tried looking on the wiki, and just randomly testing things out to try and debounce this script, so the player only get's ONE win, not 10...
Here is the script:
function Touched(hit) local hum = hit.Parent:FindFirstChild("Humanoid") if hum ~= nil then local char = hum.Parent if char ~= nil then script.Parent.Parent.Winner.Value = char print("found") wait() local plr = game.Players:GetPlayerFromCharacter(char) plr.leaderstats.Wins.Value = plr.leaderstats.Wins.Value + 1 end end end
script.Parent.Touched:connect(Touched)
Like I said, I tried quite a few ways, without any luck. |
|
|
| Report Abuse |
|
|
| |
|
Kepie
|
  |
| Joined: 12 Nov 2011 |
| Total Posts: 884 |
|
|
| 20 Apr 2013 08:29 AM |
function Touched(hit) local hum = hit.Parent:FindFirstChild("Humanoid") if hum ~= nil then local char = hum.Parent if char ~= nil then script.Parent.Parent.Winner.Value = char print("found")
wait() deb = false local plr = game.Players:GetPlayerFromCharacter(char) deb = true plr.leaderstats.Wins.Value = plr.leaderstats.Wins.Value + 1 end end end
script.Parent.Touched:connect(Touched)
|
|
|
| Report Abuse |
|
|
|
| 20 Apr 2013 08:30 AM |
debounce = false script.Parent.Touched:connect(function(p) if not debounce then debounce = true local hum = hit.Parent:FindFirstChild("Humanoid") if hum ~= nil then local char = hum.Parent if char ~= nil then script.Parent.Parent.Winner.Value = char print("found") local plr = game.Players:GetPlayerFromCharacter(char) plr.leaderstats.Wins.Value = plr.leaderstats.Wins.Value + 1 wait(2) debounce = false end end end end)
~One must risk everything to find the truth. Even if the truth isn't what you want it to be, it is better than living a lie.~ |
|
|
| Report Abuse |
|
|