Change from playeradded to part touched (every 60 mins give 1 point)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I have this script, but I want to change a bit that, but I don’t know how.

  2. What is the issue? It works perfectly, but I want that it gives every 60 minutes 1 points when someone is touching a part (like if someone touching a part and give every 60 secs +1; and if someone stopped touched it, don’t give points).

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yeah, I found that script but not with parts.

game.Players.PlayerAdded:Connect(function(hit)
	if hit then
	hit.CharacterAdded:Wait()

	if hit:GetRankInGroup(mygroup) >= 99 then
	
	while wait(60) do
		
	
		
		local leaderstats = hit.leaderstats
		leaderstats.Points.Value += 1
	
	end
	end
	end
	
end)

Example:
Player keep touching the part → Give every 60 secs 1 point;
Player stopped touching the part → Stop giving 1 point every 60 secs;
If player touched again the part, start give points again.

So, each second a player is “touching” the part, that player will be given 1 point?
If player gets far from the part or not “touching it” player wont get any point per second.
If player gets close/touch to part again, player gets in the loop of earning 1 point each second again.
?

each minute (60 seconds)
if the player leave the part, the player will not get a point every 60 minutes until touch the part again

I would go with a RunService on server side, iterating a table of players that are allowed to earn a point.

If the player still “near/touching” the part, then the player is true in the table, then the RunService function will add a point on a delta specified time.

When players are “far/lost touch” of the part, they get removed from the table that RunService is using to grant points.

1 Like

Thank you! That worked. Have a nice day.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.