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

Why is this kick script saying I am attempting to call a string value?

So I am making a kick script and I use game.Players:FindFirstChild() to find the player instance and I even had it print the classname of player and it comes out as a player instance. So why is it saying it's a string value?

game.ReplicatedStorage.Remotes.Kick.OnServerEvent:Connect(function(plr, plrToKick, msg)
	if plr:GetRankInGroup(2596382) >= 254 then

			local player = game.Players:FindFirstChild(plrToKick)
			print(player.ClassName)
			
			if player then
				player:Kick("You have been kicked by the admin "..plr.Name". Message from admin: "..msg)
			end
end)

Error: 14:09:46.499 - ServerScriptService.Kick:9: attempt to call a string value

1 answer

✓ Accepted answer

You forgot to concatenate after plr.Name :)

game.ReplicatedStorage.Remotes.Kick.OnServerEvent:Connect(function(plr, plrToKick, msg)
    if plr:GetRankInGroup(2596382) >= 254 then

            local player = game.Players:FindFirstChild(plrToKick)
            print(player.ClassName)

            if player then
                player:Kick("You have been kicked by the admin "..plr.Name..". Message from admin: "..msg)
            end
end)

2 comments

0

Oml thanks

0

Np.

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