No points limit for users in list

Hello everyone!
So I was asking myself how I could make a script that puts a limit on how much points you could earn, but there is an exception for people who are in a list.
I’m a bad scripter, but i mean something like:

local ExeptUsers = {"RubenHgamer", "SomeoneUser", "Roblox"}

???

I’m not asking for full scripts. Only whats the best way to do this.
Any tips?

ok inside the function that you should have, make an if and check if their points are less than 10, and make an else, inside the else just type return and then the end.

so if they have 10 when u do the action to gain points, it does nothing

the function that i mean is the function that makes you gain points like a block with a ClickDetector

For the part of the list, in the if, do:

you can change the else to an elseif and check the amount of points, and check if the player’s name is in the table with

elseif Points == 10 and Player.Name == ExceptUsers[Player] then

Oops nvm this is the code:


local ExeptUsers = {"RubenHgamer", "SomeoneUser", "Roblox"}


script.Parent.ClickDetector.MouseClick:Connect(function(player)
	
	local Points = player:WaitForChild("leaderstats").Points
	
	if Points.Value < 10 then
		Points += 1
	elseif player.Name == ExeptUsers[player] then
		Points += 1
		
	elseif Points == 10 and player.Name == ExeptUsers[player] then
		return
	end
end)
2 Likes

I think I did a really bad job and corrections are appreciated, but I think function of this sort should look like this.

local ExeptUsers = {"RubenHgamer", "SomeoneUser", "Roblox"}
local CoinLimit = 10
local CurrentCoins = 0

local function onCollect(player)
   if player.Name == ExeptUsers[] then
     CurrentCoins = CurrentCoins + 1 --no limit for players in ExeptUsers 
     else
        if CurrentCoins < CoinLimit then
           CurrentCoins = CurrentCoins + 1  --increment until hit CoinLimit value 
         end
     end
end
2 Likes

I think that it’s fine but i recommend you using elseif instead of using an IF inside an ELSE
because that’s only wasting memory

3 Likes

Run the function whenever you want to add points.

local ExcludedUsers = {"Test1", "Test2", "Test3"}

local Function Points (Player)
    if not ExcludedUsers[Player.Name] and Player.leaderstats.Points.Value < 10 then
        Player.leaderstats.Points.Value += 1
    elseif ExcludedUsers[Player.Name] then
        Player.leaderstats.Points.Value += 1
    end
end

1 Like