[CLOSED)How to do a owner has joined

so I been working on how to make owner has joined the server script I look it up and I made lots of mistake and dont know how to fix it can I get some advise are a script should use

2 Likes

Have you already made a script? If so, please post it so we can help you better.

1 Like

Clearify, what’s the mistake of the script?

game.Players.PlayerAdded:connect(function(plr)
     if plr.UserId == youridhere then
          -- do stuff with owner
     end
end)```
1 Like

You can also do game.CreatorId instead of youridhere.

1 Like

So I try to put my name and it never worked.

Not too sure what you are actually trying to, please be more specific. I assume you are trying to make a script that shows a message whenever an owner joins, but I do not fully understand what you are trying to do or what the error is exactly.

1 Like

Were do I put the Id if I ask.

Yes indeed that’s what i’m trying to make.

Where is says youridhere, replace it with your UserId and then do whatever you want below.

game.Players.PlayerAdded:connect(function(plr)
if plr.UserId == 1603726202 then
– do stuff with owner
end
end)```

PS: Added your ID for you.

Thank U I will test it make sure it all good.

Wanna drop that in a code box to make it a little neater
```lua
–code
```

if plr.UserId == 1603726202 then
– do stuff with owner
end
end)```

I would recommend indenting to make your code more readable for yourself and others.

game.Players.PlayerAdded:Connect(function(plr)
    if plr.UserId == 1603726202 then
        -- do stuff with owner
    end
end)
1 Like

Hello, tysm everyone for helping me and everything this is now closed have a good day,

Generic that can be used in any game.

game.Players.PlayerAdded:Connect(function(player)
    if game.CreatorType == Enum.CreatorType.User then -- So no errors (checking if its a player obj)
        if player.UserId == game.CreatorId then
            -- Now that the owner has joined, stuff goes below!
        end
    end)

Use CreatorId like @IntelligentCappy advised.

1 Like

stick one of these codes as a solution so no one replies