Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My onTouch points script isn't working when I test it. What am I doing wrong?

I'm new to the language, and I'm having trouble with a script that adds one point when it is touched. Eventually, I want to make it loop and add one point every second, but for now, I'm just trying to make the main script work, but it's not and I'm not sure why? Could someone inform me what I'm doing wrong?

Points = game.Players.PlayerAdded.leaderstats.Score

local Debounce = true

function onTouch()

if Debounce then 
Debounce = false 

	Points = Points + 1

end
end
script.Parent.Touched:connect(onTouch)

1 comment

0

What is Score a number value?

1 answer

✓ Accepted answer
game.Players.PlayerAdded:connect(function(player)
script.Parent.Touched:connect(function(a)
player.leaderstats.Score.Value = player.leaderstats.Score.Value + 1
end)
end)

Thats if its a value also you can add the debounce yourself if you want it accept if helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.