generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: I am not sure what this error means?

Previous Thread :: Next Thread 
F3XStudios is not online. F3XStudios
Joined: 08 Nov 2015
Total Posts: 94
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
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
12 Feb 2016 08:53 PM
getplayerfromcharacter requires a argument of a player type



https://www.youtube.com/watch?v=onhFH7jpq2c
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
12 Feb 2016 08:53 PM
like this:
local player = game.Players:GetPlayerFromCharacter(plrname)


https://www.youtube.com/watch?v=onhFH7jpq2c
Report Abuse
Reset8954098 is not online. Reset8954098
Joined: 01 Dec 2007
Total Posts: 336
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
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
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
Reset8954098 is not online. Reset8954098
Joined: 01 Dec 2007
Total Posts: 336
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
Icecreamtopblank is not online. Icecreamtopblank
Joined: 11 Sep 2011
Total Posts: 682
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
Reset8954098 is not online. Reset8954098
Joined: 01 Dec 2007
Total Posts: 336
12 Feb 2016 10:11 PM
@Icecreamtopblank
"GetCharacterFromPlayer"~="GetPlayerFromCharacter"
Report Abuse
Icecreamtopblank is not online. Icecreamtopblank
Joined: 11 Sep 2011
Total Posts: 682
12 Feb 2016 10:11 PM
ooohh
my bad xD
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
13 Feb 2016 02:04 AM
i need better eyes


https://www.youtube.com/watch?v=onhFH7jpq2c
Report Abuse
OzzyFin is not online. 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
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image