So, I wrote a script. It's supposed to check if you're on the approved spawner list, and if you are, it spawns in a gun. However, it does not work.

local isSpawner = {["gitrog"] = true, ["M8sOfTarkir"] = true, ["PastoBXL"] = true}
 
function onChatted(message, player)
    if message == "/sp tec" and isSpawner[player.Name] then
		game.ServerStorage.SpawnerStorage["Tec-9"]:Clone().Parent = game.Players.player.Backpack
    end
end
 
game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(message) onChatted(message, player) end)
end)

5 comments

0

Errors?

0

player is not a valid member of Players

1

Tried game.Players[player.Name].Backpack ?

0

It's treating player as the name of a child itself looking for a child called "player".

0

@BobserLuck That worked. Can you write that as an answer, so I can mark it as correct?