local player = workspace:FindFirstChild("Player")
if player.TeamColor==BrickColor.new("Medium stone grey") then
print("Player is a civilian, no shot ammo for you!")
elseif player.TeamColor==BrickColor.new("Bright red") or player.TeamColor==BrickColor.new("Navy blue") or player.TeamColor==BrickColor.new("Navy blue") then
script.Parent.ClickDetector.MouseClick:connect(function(plr)
ypcall(function()
for _,v in pairs(plr.Character:children()) do if v:IsA("BasePart") then v.Anchored = false end end
script.Parent.AmmoGiver:Clone().Parent = plr.PlayerGui
end)
end)
end
11:05:24.855 - Workspace.Limber.Ammo Box.Innards.Clicky.Script:3: attempt to index local 'player' (a nil value)
How do I fix this?

4 comments
Thank you, although while there is now no error, it doesn't work either
I'll edit my answer and try to fix it with that.
Still doesn't work, darn.
Oh, well, I only fixed the part with getting the players. I could totally rewrite it for you if you want.