Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make it so when a certain player joins something happens to them?

Asked by 10 years ago

I know some part of the script ~~~~~~~~~~~~~~~~~ function onPlayerEnter:connect ~~~~~~~~~~~~~~~~~ I think XD

2 answers

Log in to vote
0
Answered by 10 years ago

The event you are looking for is PlayerAdded:

Names = {"PlayerNameHere"}
game:GetService("Players").PlayerAdded:connect(function(Plr)
    wait(1/30)
    for _,v in next, Names do
        if v:lower() == Plr.Name:lower() then
            --Stuff happens here
            --Example: Plr.Character:BreakJoints()
        end
    end
end)
0
That's close to what i need I really need if the players name is in the script so and so happens paulieD123 5 — 10y
0
Edited it so that if your username in in the table, only then does stuff happen. Archonious2 160 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Use this example instead, it is more safer.

game.Players.PlayerAdded:connect(function(player)
    repeat wait() until player ~= nil
    -- code here :)
end)

Answer this question