Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

concatenation problem with my kick ui?

I am having a problem with my kick UI, I wanted it to link to discord with the username of the reported player however it works if its only this

but whenever I try to combine them I kept on having this problem attempt to concatenate the string with Instance

username = playername;
-- it works when its not combined
username = kickedid;
local allowed = {365076566,549987435,467986879,122742284,253925962,90006451,}
game.Players.PlayerAdded:Connect(function(player)
	for i, v in pairs(allowed) do
		if player.UserId == v then
			script.KickGui:Clone().Parent = player.PlayerGui
			print("Allowed")
		end
	end
end)

game.ReplicatedStorage.RemoteEvents.KickPlayer.OnServerEvent:Connect(function(player, playerToKick, reason)
	for i, v in pairs(allowed) do
		if player.UserId == v then
			local chat = game:GetService('Chat')
			local httpService = game:GetService('HttpService')
			local replicatedStorage = game:GetService('ReplicatedStorage')

			local sendFeedback = replicatedStorage.RemoteEvents.Report

			local webhook = 

			sendFeedback.OnServerEvent:Connect(function(Player, kicked, reason)
				local playername = game.Players:FindFirstChild(kicked)
				local kickedid = playername.UserId
				local formatted = httpService:JSONEncode({
					content = chat:FilterStringAsync(reason, playername, playername );
					username = playername .."-".. kickedid; -- its here
					avatar_url = ('https://www.roblox.com/headshot-thumbnail/image?userId=' .. kickedid .. '&width=420&height=420&format=png');
				})
				httpService:PostAsync(webhook, formatted)
				game.Players:FindFirstChild(playerToKick):Kick(reason)
			end)
		end
	end
end)

1 comment

0

Edit your answer and delete the webhook. Anyone could get it and use it, including sending a lot of messages in a spam of a second to get you banned.

1 answer

✓ Accepted answer

Try doing this instead:

username = playername.Name .."-".. kickedid;

the reason: playername is an instance player which is the player to kick, so you could do playername.Name. hope this helps!

1 comment

0

Thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.