Script wont work when i give user id

Im using a trello system to manage my bans but when i try and get it to upload a card with the player id it wont work why is this?
here is my script

game.ReplicatedStorage.KickPlayer.OnServerEvent:connect(function(playr, playerToKick, reason, player)
    	local player1 = game.Players:FindFirstChild(playerToKick)
    	local playerid = player1.UserId
    TrelloAPI:AddCard(playerid, reason, ListID2)

There isn’t enough information here for us to figure out whats going wrong. Are there any errors/warnings being printed in the console? What exactly is TrelloAPI:AddCard() doing? The problem is likely to be in that function. It’d also be useful to know what arguments are being passed to the remote.

Some other things, you should definitely be checking if the player who fired the remote has permission to kick, passing the player instance of the kick target instead of their username (or just the UserId to simply things further), and checking that playerToKick isn’t nil before calling AddCard().

Edit: You should also use :Connect (capital C) instead of :connect (lowercase c, deprecated)


it might be that playerToKick is already a player, or is a character.

if its already a player no need to do:
local player1 = game.Players:FindFirstChild(playerToKick)

If its a character you should be using :getPlayerFromCharacter(playerToKick)

And if playerToKick is a name, I assume you got it from a character, so instead of setting playertokick as a stringvalue you should set it as a player.
playertokick = :getPlayerFromCharacter(character)


Could you please send the client end script? Your issue would be a lot easier to solve. Let me know if there are other issues.

1 Like

It prints the id just fine but wont add the card

what exactly do you mean by client script?

Can we see what TrelloApi:AddCard() does?

it adds a card to a trello list

Oops, I completely missed the .Kick, in that case, it uses API services outside of Roblox, which could be a problem with your scripts elsewhere, also did you try printing all the information, and was it successful? Is API services also on? Check all that and then let me know further issues.

1 Like

i get no errors and when i make it send the username instead it works just fine

Are you sure your issue is within Roblox?

I just fixed it by doing this

TrelloAPI:AddCard(playerid.."", reason, ListID2)

Great! But I’m still confused as to why adding a string to the player’s UserId would fix it. Please let me know why that solved your issue as I would like to learn too! :slight_smile:

1 Like

hey can you try doing tostring(playerid)? see if that works