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

PlayerAdded is not a valid member of ServerScriptStorage?

Asked by 6 years ago

There were many errors in my script I had to fix up. I was capable of fixing all of the errors with no problem until this error came up: PlayerAdded is not a valid member of ServerScriptStorage

As a new scripter, I don't really know what that error message means, and I'm not sure what to do about it.

If someone could explain this error message and what I'm supposed to do about it, please help.

Here's the script:

01function rank()
02    if newPlayer:IsInGroup(4266272) then
03        if Player:GetRankInGroup(255) then
04            print("You are the owner, yay!")
05        else
06            print("You aren't the owner..")
07    end
08    end
09    end
10 
11script.Parent.PlayerAdded:connect(rank)

I did this script for a little bit of experimenting and testing.

2 answers

Log in to vote
0
Answered by 6 years ago

This is because in the ServerScriptService, there is no event called PlayerAdded. You’re looking for the Players service.

1function rank(plr)
2    if plr:GetRankInGroup(4266272) == 255 then
3        print(plr.Name, "is the owner of the group!")
4    end
5end
6 
7game:GetService("Players").PlayerAdded:Connect(rank)
Ad
Log in to vote
-1
Answered by 6 years ago

replace script.Parent in the bottom of the script with game.Players Example

01function rank()
02if newPlayer:IsInGroup(4266272) then
03 
04if Player:GetRankInGroup(255) then
05print("You are the owner, yay!")
06  else
07 print("You aren't the owner..")
08end
09end
10 
11end
12 
13 
14game.Players.PlayerAdded:connect(rank)
0
No. User#19524 175 — 6y
0
You still didn’t fix the other code (which had errors), and using game.Players isn’t smart. User#19524 175 — 6y
0
there goes incapaz thinking that he knows everything lmao masterblokz 58 — 6y

Answer this question