Hello! So I’m trying to make it so admins have weapons, but whenever I try to make it so that whenever the admins or devs respawn, and when they join the game that they get the weapons, but that doesnt work with my script. Here’s the error,
local players = {"CarlosGamer81239", "NubblyFry"}
local tool = game.ServerStorage:FindFirstChild("DEV_FuseNuke")
game.Player.PlayerAdded:Connect(function(plr)
local char = plr.CharacterAdded while true do
local backpack = plr:WaitForChild("Backpack")
for _,v in pairs(players) do
if plr.Name == v then
local newTool = tool:Clone()
newTool.Parent = backpack
newTool.Name = "DEV_FuseNuke"
end
end
end
and this line why?
You can use StarterGear to not add the tool every time the Character is loaded, this works best:
local players = {"CarlosGamer81239", "NubblyFry"}
local tool = game.ServerStorage:FindFirstChild("DEV_FuseNuke")
game.Player.PlayerAdded:Connect(function(plr)
if table.find(players,plr.Name) then
local newTool = tool:Clone()
newTool.Parent = plr.StarterGear
newTool.Name = "DEV_FuseNuke"
end
end)
Syntax error, just create a CharacterAdded event instead
local players = {"CarlosGamer81239", "NubblyFry"}
local tool = game.ServerStorage:FindFirstChild("DEV_FuseNuke")
game.Players.PlayerAdded:Connect(function(plr)
local backpack = plr:WaitForChild("Backpack")
plr.CharacterAdded:Connect(function(char)
for _,v in pairs(players) do
if table.find(players, v.Name) then
local newTool = tool:Clone()
newTool.Parent = backpack
newTool.Name = "DEV_FuseNuke"
end
end
end)
end)
local players = {"CarlosGamer81239", "NubblyFry"}
local tool = game.ServerStorage:WaitForChild("DEV_FuseNuke")
game.Player.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local backpack = plr:WaitForChild("Backpack")
if plr and plr.Name = players[1] or players[2] then
local newTool = tool:Clone()
newTool.Parent = backpack
end
end)
local players = {"CarlosGamer81239", "NubblyFry"}
local tool = game.ServerStorage:FindFirstChild("DEV_FuseNuke")
game.Players.PlayerAdded:Connect(function(plr) -- needed an extra 's' at the end of players
plr.CharacterAdded:Connect(function(char)
local backpack = plr:WaitForChild("Backpack")
for _,v in pairs(players) do
if plr.Name == v then
local newTool = tool:Clone()
newTool.Parent = backpack
newTool.Name = "DEV_FuseNuke"
end
end
end)
end) -- needed an )
local players = {"CarlosGamer81239", "NubblyFry"}
local tool = game.ServerStorage:FindFirstChild("DEV_FuseNuke")
game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local backpack = plr:WaitForChild("Backpack")
for _,v in pairs(players) do
if plr.Name == v then
local newTool = tool:Clone()
newTool.Parent = backpack
newTool.Name = "DEV_FuseNuke"
end
end
end)