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

Get 1 point on the leader board every second as long as you stay on block?

I tried to create a script inside of a part where you get 1 point every second as long as you stay on a block. This is for a king of the hill gamemode im working on. 1 issue, it only happens once, if you are staying on it. but if you step off of it then step back on, it works sorta. just put this script inside of a part. and stay on top of it. see for yourself.

db = false
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if db == false then
			db = true
			script.Parent.BrickColor = BrickColor.new("Really black")
			player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
			wait(1)
			script.Parent.BrickColor = BrickColor.new("Really red")
			db = false
		end
	end
end)

1 answer

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