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 11 years ago

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

2 answers

Log in to vote
0
Answered by 11 years ago

The event you are looking for is PlayerAdded:

01Names = {"PlayerNameHere"}
02game:GetService("Players").PlayerAdded:connect(function(Plr)
03    wait(1/30)
04    for _,v in next, Names do
05        if v:lower() == Plr.Name:lower() then
06            --Stuff happens here
07            --Example: Plr.Character:BreakJoints()
08        end
09    end
10end)
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 — 11y
0
Edited it so that if your username in in the table, only then does stuff happen. Archonious2 160 — 11y
Ad
Log in to vote
0
Answered by 11 years ago

Use this example instead, it is more safer.

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

Answer this question