Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is wrong with this Script? Touch Event and Leaderstats

Asked by 4 years ago

game.Players.PlayerAdded:Connect(function(players)

local leaderstats = Instance.new("Folder", players)
leaderstats.Name = "leaderstats"

local points = Instance.new("IntValue",leaderstats)
points.Name = "Points"

end)

debounce = false local part = script.Parent part.Touched:Connect(function(hit) local humanoid = game.Players:FindFirstChild(hit.Parent.Name)

if humanoid then

    if debounce == false then
        debounce = true

    local playerPoints = players.leaderstats.points
    playerPoints.Value = playerPoints.Value + 1
    end
end

end)

0
care to explain the PROBLEM, it should work once since you arent changing the debounce again. greatneil80 2647 — 4y
0
Yeah you need to be debounce = false after you do it so that it will run again. Unless you only want it to run once. SethHeinzman 284 — 4y

Answer this question