Been looking all over youtube and cant seem to find any but how would i be able to give a player an amount of points if there in said group. I have a script that gives you a tool when your in the group but got stuck when trying to trouble shoot with leaderstats instead of tools
can you send us your code? by the way
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if player:GetRankInGroup(14822131) >= 1 then
for i, v in pairs(player.Backpack:GetChildren())do
if v:IsA(“Tool”) and v.Name == “TripleRockets” then
v:Destroy()
end
end
for i, v in pairs(character:GetChildren())do
if v:IsA(“Tool”) and v.Name == “TripleRockets” then
v:Destroy()
end
end
local ServerStorage = game:GetService(“ServerStorage”)
local tool = game.ServerStorage.TripleRockets
local clonedTool = tool:Clone()
clonedTool.Parent = player.Backpack
end
end)
end)
Sorry i meant to add it but this is the tool script i have
this is a local script or a script?
just a script not a local script
ok, what’s the parent of the script?
Format your script
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if player:GetRankInGroup(14822131) >= 1 then
for i, v in pairs(player.Backpack:GetChildren())do
if v:IsA(“Tool”) and v.Name == “TripleRockets” then
v:Destroy()
end
end
for i, v in pairs(character:GetChildren())do
if v:IsA(“Tool”) and v.Name == “TripleRockets” then
v:Destroy()
end
end
local ServerStorage = game:GetService(“ServerStorage”)
local tool = game.ServerStorage.TripleRockets
local clonedTool = tool:Clone()
clonedTool.Parent = player.Backpack
end
end)
end)
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