|
| 12 Feb 2016 08:50 PM |
I am not sure what this error means?
18:48:57.291 - Argument 1 missing or nil 18:48:57.292 - Script 'ServerScriptService.Script', Line 15 18:48:57.293 - Stack End
local function WaitForChild(parent, childName) assert(parent, "ERROR: WaitForChild: parent is nil") while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end
local ChatStorage = game.Workspace:FindFirstChild("ChatStorage") local GamePassIdObject = script.N.Value local GamePassService = game:GetService('GamePassService') local PlayersService = game:GetService('Players')
game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(Message) local StringVal = Instance.new("StringValue", ChatStorage) local player = PlayersService:GetPlayerFromCharacter() if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then StringVal.Name = "[VIP]"..plr.Name.." : "..Message else StringVal.Name = plr.Name.." : "..Message end end) end)
|
|
|
| Report Abuse |
|
|
|
| 12 Feb 2016 08:53 PM |
getplayerfromcharacter requires a argument of a player type
https://www.youtube.com/watch?v=onhFH7jpq2c |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2016 08:53 PM |
like this: local player = game.Players:GetPlayerFromCharacter(plrname)
https://www.youtube.com/watch?v=onhFH7jpq2c |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2016 08:56 PM |
"local player = PlayersService:GetPlayerFromCharacter() if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then"
One, PlayerHasPass requires a Instance with class of 'Player', I don't know where you could've gotten the idea it requires a Character. http://wiki.roblox.com/index.php?title=API:Class/GamePassService/PlayerHasPass
Two, the first argument was nil due to the face 'GetPlayerFromCharacter' has no argument(Oh wait, that could be what's causing the error). GetPlayerFromCharacter requires a model instance to attempt to get a Player Instance from. So, the fact that you're trying to do that, "player" would "==nil". If you're trying to get the client the local script is in, then use "Players.LocalPlayer". http://wiki.roblox.com/index.php?title=API:Class/Players/GetPlayerFromCharacter http://wiki.roblox.com/index.php?title=API:Class/Players/LocalPlayer
Three, it's not recommended to use "GamePassService.PlayerHassPass" due to the fact that it's cached. Try "MarketplaceService.PlayerOwnsAsset" instead. http://wiki.roblox.com/index.php?title=API:Class/MarketplaceService/PlayerOwnsAsset |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2016 09:01 PM |
oh i read that wrong yeah it requires a model type (which would be a player's character) i was thinking of GetCharacterFromPlayer
https://www.youtube.com/watch?v=onhFH7jpq2c |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2016 09:08 PM |
@cpmoderator12345 There is no such method of "GetCharacterFromPlayer", instead use "Player.Character" to get the Character model of a Player. |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2016 10:06 PM |
http://wiki.roblox.com/index.php?title=API:Class/Players/GetPlayerFromCharacter
I mean... it's a function....
You're right though not a method |
|
|
| Report Abuse |
|
|
|
| 12 Feb 2016 10:11 PM |
@Icecreamtopblank "GetCharacterFromPlayer"~="GetPlayerFromCharacter" |
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Feb 2016 02:04 AM |
i need better eyes
https://www.youtube.com/watch?v=onhFH7jpq2c |
|
|
| Report Abuse |
|
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 13 Feb 2016 02:15 AM |
"I mean... it's a function....
You're right though not a method"
you can call functions as methods
game.Players:GetPlayerFromCharacter(char) would call GetPlayerFromCharacter with game.Players as the first argument, it is called a method and would equal to game.Players.GetPlayerFromCharacter(game.Players,char) |
|
|
| Report Abuse |
|
|
|
| 14 Feb 2016 02:51 PM |
true but thats a bad practice unless you like to obfuscate code
https://www.youtube.com/watch?v=onhFH7jpq2c |
|
|
| Report Abuse |
|
|