Hi, So i been making this weapon spawner script and you prob saying how does it work? well when a player who owns the gamepass says the command in the script "/sg revolver" a text appears saying they have spawned a weapon and how many more they have left to spawn. If they don't own the gamepass and say the command nothing happens and weapon wont spawn. So the thing is that it isn't working how isnt it working? May you be asking well the thing is that any player can spawn it and i only want the players that own the gamepass to be able to spawn the weapon. Please Help
function onChatted(message, player) if message == "/sg revolver" and game.MarketplaceService:UserOwnsGamePassAsync(player.UserId, 18855590) then if player.Limit.Value > 0 then game.ServerScriptService.KostanaPack.Revolver:Clone().Parent = player.Backpack player.Limit.Value = player.Limit.Value - 1 player.PlayerGui.SpawnerViews.Spawner.Enabled = true player.PlayerGui.SpawnerViews.Spawner.TextLabel.Text = "You have ".. player.Limit.Value.."/15 guns left to spawn!" wait(2) player.PlayerGui.SpawnerViews.Spawner.Enabled = false elseif player.Limit.Value == 0 then player.PlayerGui.SpawnerViews.Spawner2.Enabled = true player.PlayerGui.SpawnerViews.Spawner2.TextLabel.Text = "You have no guns left to spawn" wait(2) player.PlayerGui.SpawnerViews.Spawner2.Enabled = false end end end game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end)