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

im working on a kick script but it doesent seem to be working, can i have some help?

how its supposed to work is: admin presses a button and it will check who the player they are trying to kick is and to see if there is a specified reason, it will change a few variables in replicated storage and fires off a remote event which tells a server script to call this function

local selectedplayer = nil
local Text = nil


game.ReplicatedStorage.KickEvent.OnServerEvent(function()
	selectedplayer = game.ReplicatedStorage.PlayerSel.Value
	Text = game.ReplicatedStorage.Text.Value
	
	if Text ~= nil then
		game.Players:FindFirstChild(selectedplayer):Kick("you have been kicked becuse:" .. Text)
	else
		game.Players:FindFirstChild(selectedplayer):Kick("you have been kicked")
	end
end)

problem is it keeps saying " ServerScriptService.Script:5: attempt to call field 'OnServerEvent' (a userdata value)"

i have no clue what the means, can anyone help?

1 answer

✓ Accepted answer
game.ReplicatedStorage.KickEvent.OnServerEvent:Connect(function()

Try this maybe, you forgot to add :Connect

1 comment

0

oml im stupid XD

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