Hello there!
I made a script that says when a player that is in my group and his rank is 1 it puts him in a specific team and gives him a weapon but the problem is the weapon does not appear.
Can you help?
This is my script:
local players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local function playerAdded(player)
local playerRank = player:GetRankInGroup(33119741)
local Bp = player:WaitForChild("Backpack")
if playerRank <= 1 then
player.Team = Teams : FindFirstChild("Presintential Guard")
local clone = ReplicatedStorage.Musket:Clone()
clone.Parent = Bp
end
if playerRank >= 2 then
player. Team = Teams : FindFirstChild("Member Of The Greeks Parliament")
end
if playerRank >= 3 then
player. Team = Teams : FindFirstChild("Chiefs Of The Greek Presintential Guard")
end
if playerRank >= 255 then
player. Team = Teams : FindFirstChild("Prime Minister")
end
end
players. PlayerAdded : Connect (playerAdded)
have you tried doing clone.Parent = player.Backpack
instead of using the variable?
You’re determining the variable BP before the if statement, which checks if the playerRank >= 1
Does not work either.Anything else?
Still nothing I don’t know why…
you use Teams
but you don’t have a variable for it
I don’t think that’s the case. I am asking for the item.
If the script errors before the line that isn’t working, then that will cause the issue.
so, if the script errors because you’re using Teams
without it being an actual variable, then nothing after that line will work
It doesn’t show any errors at the line.
local players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Teams = game:GetService("Teams") -- You need to get the Teams service
local function playerAdded(player)
local playerRank = player:GetRankInGroup(33119741)
local Bp = player:WaitForChild("Backpack")
if playerRank <= 1 then
player.Team = Teams:FindFirstChild("Presidential Guard") -- Fixed typo in team name
local clone = ReplicatedStorage.Musket:Clone()
clone.Parent = Bp
elseif playerRank >= 2 and playerRank < 3 then -- Changed to include players with rank 2 but not rank 3
player.Team = Teams:FindFirstChild("Member Of The Greek Parliament")
elseif playerRank >= 3 and playerRank < 255 then -- Changed to include players with rank 3 but not rank 255
player.Team = Teams:FindFirstChild("Chiefs Of The Greek Presidential Guard")
elseif playerRank >= 255 then
player.Team = Teams:FindFirstChild("Prime Minister")
end
end
players.PlayerAdded:Connect(playerAdded)
1 Like
Nothing again I don’t know what to do.
you said there is no output right, maybe code gets stuck somewhere at one point
No I checked everything there.
ah got it, maybe you wrote the group id wrong? if thats the case check it
No because the script works but the only thing it doesn’t work is the item giver
can you explain the issue a bit more? i think i know the solutiom
Is the item even cloning? If it is not giving the item, it is not cloning then?
I made this script which says that if a player is in my group in roblox and he is at a specific rank he will be in a specific team.Now about the rank with the item I have the issue the rank that it says its the 1st rank which is the Supporter if that player has that rank he will be in the guards team so he will get a weapon that other teams don’t but that weapon does not appear at my backpack. I hope that helps…
I will check I will use print…
try to use findfirstchild insstead of waitforchild