I'm creating a script that simply looks for the player's userids, what guns there allowed to spawn, and how many spawns they have left. The script seems to stop reading things correctly past if table.find(owners, plr.UserId) then which is that part that looks for the players userid.
local adminguns = {"G26L","G17"}
local owners = {"46315828"}
local amount = 10
game.Players.playerAdded:Connect(function(plr)
plr.Chatted:Connect(function(message)
print("plrchat")
if message and string.sub(message, 1, 7):lower() == "/spawn " then
print("plrsaidspawn")
if table.find(owners, plr.UserId) then
print("plrfound")
if table.find(adminguns, string.sub(message, 7)) then
print("admingunfound")
if amount > 0 then
print("amountmorethanzero")
local firearms = game.ServerStorage.Assets:WaitForChild("Firearms")
if firearms:FindFirstChild(string.sub(message, 7)) ~= nil then
print("weaponnotnil")
local spawn = firearms:FindFirstChild(string.sub(message, 7)):Clone()
spawn.Parent = plr.Backpack
amount = (amount - 1)
print("worked!")
end
end
end
end
end
end)
end)

1 comment
Thanks! I see now.