So, I have a script that checks a players rank upon joining the game and their team. If they have the correct requirements, they will receive a tool provided in a variable. For some reason, the tool is not being added to the players backpack once spawned in. How would I fix this? There are no errors as well.
local Clearance1Card = game.ServerStorage.Tools["Clearance I"]:Clone()
local Clearance2Card = game.ServerStorage.Tools["Clearance II"]:Clone()
local Clearance3Card = game.ServerStorage.Tools["Clearance III"]:Clone()
local Clearance4Card = game.ServerStorage.Tools["Clearance IV"]:Clone()
local Clearance5Card = game.ServerStorage.Tools["Clearance V"]:Clone()
local MP40 = game.ServerStorage.Tools.MP40:Clone()
local PMM = game.ServerStorage.Tools.PMM:Clone()
local Player = game.Players.LocalPlayer
local TeamService = game:GetService("Teams")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function()
if plr:GetRankInGroup(TheStormDetachmentGroupID) <= 2 then
if plr.Team == TeamService["The Storm Detachment"] then
print(plr)
Clearance1Card.Parent = plr.Backpack
PMM.Parent = plr.Backpack
elseif plr:GetRankInGroup(TheStormDetachmentGroupID) >= 1 and plr:GetRankInGroup(TheStormDetachmentGroupID) <= 5 then
if plr.Team == TeamService["The Storm Detachment"] then
print(plr)
MP40.Parent = plr.Backpack
Clearance2Card.Parent = plr.Backpack
elseif plr:GetRankInGroup(TheStormDetachmentGroupID) == 254 then
if plr.Team == TeamService["The Storm Detachment"] then
print(plr)
MP40.Parent = plr.Backpack
Clearance5Card.Parent = plr.Backpack
end
end
end
end
end)
end)
I am getting so much mixed signals here, why can’t you use a regular server script inside ServerScriptService? You could just clone & parent the Tool into the Player’s Backpack without no issue
You’re also only Cloning the Tool once, which could be the issue why
This took a while to figure out as your script is a bit messy, but I suppose this should give you a start maybe?
local Clearance1Card = game.ServerStorage.Tools["Clearance I"]
local Clearance2Card = game.ServerStorage.Tools["Clearance II"]
local Clearance3Card = game.ServerStorage.Tools["Clearance III"]
local Clearance4Card = game.ServerStorage.Tools["Clearance IV"]
local Clearance5Card = game.ServerStorage.Tools["Clearance V"]
local MP40 = game.ServerStorage.Tools.MP40
local PMM = game.ServerStorage.Tools.PMM
local TeamService = game:GetService("Teams")
local TheStormDetachmentGroupID = 000000 --You never included this in your script
local function PlayerAdded(Plr)
Plr.CharacterAdded:Connect(function(Chr)
local PlayerRank = Plr:GetRankInGroup(TheStormDetachmentGroupID)
print("[DEBUGGING]")
print("Player's Team: ", Plr.Team)
print("Player's Rank: ", PlayerRank)
if Plr.Team == TeamService["The Storm Detachment"] then
if PlayerRank == 254 then
local CardClone = Clearance5Card:Clone()
CardClone.Parent = Plr.Backpack
local WeaponClone = MP40:Clone()
WeaponClone.Parent = Plr.Backpack
elseif PlayerRank <= 2 then
local CardClone = Clearance1Card:Clone()
CardClone.Parent = Plr.Backpack
local WeaponClone = PMM:Clone()
WeaponClone.Parent = Plr.Backpack
elseif PlayerRank >= 1 and PlayerRank <= 5 then
local CardClone = Clearance2Card:Clone()
CardClone.Parent = Plr.Backpack
local WeaponClone = MP40:Clone()
WeaponClone.Parent = Plr.Backpack
end
end
end)
end
game.Players.PlayerAdded:Connect(PlayerAdded)
How would I do this for multiple groups?