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

need help with script why will player:kick work in one but not the other?

why will the player:kick work here?

game.Players.PlayerAdded:connect(function(player)
    player.Chatted:connect(function(msg)
        if(msg == "I dont feel so good") then
            player:kick ("Thanos Snapped")
        end
    end)
end)

and not here

function clicked()
 player:kick ("oof")
end
script.Parent.MouseButton1Click:Connect(clicked)

pls help

1 answer

"player" is not defined. Put this in a localscript:

local player = game.Players.LocalPlayer

function clicked()
 player:kick ("oof")
end
script.Parent.MouseButton1Click:Connect(clicked)

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