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

Developer has join script help?

Asked by 10 years ago

So Im making a game and wanted a developer had joined script it worked with one person but not two. Can someone explain to me what I did wrong?

01local Players = Game:GetService("Players")
02 
03function PlayerAdded( newPlayer )
04    if newPlayer.Name == "GuardainDev, StevenzsDev" then
05        local msg = Instance.new("Message", Workspace)
06        msg.Text = "A Developer has joined the game."
07        wait(6)
08        msg:Destroy()
09    end
10end
11 
12Players.PlayerAdded:connect(PlayerAdded)
0
line 04 - I think you should try "GuardianDev","StevenzsDev" instead of "GuardainDev, StevenzsDev" kudorey619 138 — 10y

1 answer

Log in to vote
4
Answered by 10 years ago

There are several things wrong with your code. I'll highlight them with comments. Here's the corrected code:

01a = game.Players:GetChildren()--Better to use GetChildren, and it shouldn't be local either.
02m = Instance.new("Message")
03 
04function DevMsg() --You had spaces in between the parentheses and the "NewPlayer", it is better to just have nothing in the parentheses
05--I've pretty much rewritten everything below this line
06    for i,v in pairs(a) do
07        if v.Name == "GuardainDev" or "StevenzsDev" then
08            m.Parent = game.Workspace
09            m.Text = "A Developer has joined the game."
10            wait(6)
11            m:Destroy()
12        end
13    end
14end
15 
16game.Players.PlayerAdded:connect(DevMsg)

Basically, the script above runs the function DevMsg every time a player joins. When as player joins, the script runs through everyone in the Players and checks if their name is GuardainDev or StevenzsDev.

If this doesn't work let me know, though it should work.

Ad

Answer this question