Group points script help

Dont have any parents for it. Its just a lone script with that code thats all

Where did you put that script? like ServerScriptService.

drew a blank for a sec but its in my ServerScriptService yes

The scripts needs a parent… where did you put that?

Uh, i mean, don’t get the player with PlayerAdded event in a server script bud

make a local script and put it in the tool and get the player with:

local player = game.Players.Localplayer

Still learning with it but thanks for the extra input with local player

I’ll show you with code wait a minute

Can you try?

game.Players.PlayerAdded:Connect(function(player)
	if player:IsInGroup(14822131) then
		player.CharacterAdded:Connect(function(character)
			for _, v in pairs(player.Backpack:GetChildren())do
				if v:IsA("Tool") and v.Name == "TripleRockets" then
					v:Destroy()
				end
				task.wait()
			end
			for _, v in pairs(character:GetChildren())do
				if v:IsA("Tool") and v.Name == "TripleRockets" then
					v:Destroy()
				end
				task.wait()
			end
			
			local ServerStorage = game:GetService("ServerStorage")
			local tool = game.ServerStorage:FindFirstChild("TripleRockets")
			local clonedTool = tool:Clone()
			clonedTool.Parent = player.Backpack
				end)
		end
end)

Put this in ServerScriptService. Not a LocalScript.

This and this is different.

“TripleRockets”
"TripleRockets"

It seems you using unsupported format.

Ok this is how do you make leaderstats:

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	
	local Points = Instance.new("NumberValue")
	Points.Name = "Points"
	Points.Parent = leaderstats
end)

and this is a little example of what i think that you want:

local player = game.Players.LocalPlayer

script.Parent.Activated:Connect(function()
	player.leaderstats.Points.Value += 5
end)

the first script is a server script in ServerScriptService and the second one, a local script inside the tool.

Don’t get the player in a player added event to use it all the time, more in server scripts, that’s a really bad practice, instead use remotes.

Local script very vulnerable. exploiters can change value.

Are we talking about that?

Also, i said that he can use remotes for more security if he wants

My question tho is the second script for a tool specifically? Cause i was looking for players getting an amount of points for being in a group. Confused honestly on it.

Oh if they join a group then to add them the points? only move the local script to StarterPlayerScripts and copy this:

local player = game.Players.LocalPlayer

if player:IsInGroup("Here your id") then                    
	player.leaderstats.Points.Value += 5   
end

it works fine but now i have issue of it resetting the points to 10000 even tho you have like lets say 3000. should be 13000 but changes to 10000 only.

i don’t understand, do you want to add your points to a variable???

I want the points to be added when a player is in a group but i dont want it to affect a players current Points that are saved. Currently it just resets there points to whatever amount I put. It doesnt add them it just changes to the amount in +=

That’s strange because = does reset that, and += should add. maybe you can try:

player.leaderstats.Points.Value = player.leaderstats.Points.Value + 5

it’s the same but maybe?

Imma give it a try give me one moment