So for the past 3 hours, I have been trying to script the code I already connected to Trello, and everything only thing I'm having a problem with is scripting a gun spawner that connects to Trello like for example if a player says a command like "/sg deagle" and if they're in the Trello list it spawns in there inventory I am frustrated here's my script and if you have a fix to it please tell me.
local API = require(game.ServerScriptService:WaitForChild("TrelloAPI")) local SpawnersBoardID = API:GetBoardID("Gun Spawners Owners") local SpawnersListID = API:GetListID("SpawnerOwners",SpawnersBoardID)
function onChatted(message, player) local SpawnersCard = API:GetCardsInList(SpawnersListID) for _, Player in pairs(game.Players:GetChildren()) do for _, Card in pairs(SpawnersCard) do if message == "/sg deagle" and string.find(Card.name, Player.UserId) then if player.Limit.Value > 0 then game.ReplicatedStorage.FirearmsSpawners.Deagle:Clone().Parent = player.Backpack -- put all guns in a folder called "Firearms" in replicated storage 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(10) 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(10) player.PlayerGui.SpawnerViews.Spawner2.Enabled = false end end end
end
game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(message, player) end) end)