Hello! I followed this tutorial(https://www.youtube.com/watch?v=RyPvgpad1Do) on how I would make it so when you are touching the part it will give you a point every 3 secounds. I later found out that it will only give points to one of the players touching the part. Does anyone know how I would make it so it gives points to everyone who is touching the part?

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
			player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
			wait(3)
			db = false
		end
	end
end)

1 comment

0

Nvm, I have made it working.