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 » Scripting Helpers
Home Search
 

Why is this nil?

Previous Thread :: Next Thread 
Joshua7851 is not online. Joshua7851
Joined: 18 Nov 2012
Total Posts: 210
16 Nov 2014 02:03 AM
Ive looked at this multible times over and over again, it just comes up nil.

playertoc is a character from a PlayerTouched event

local playerpl = game.Players:GetPlayerFromCharacter(playertoc)
Report Abuse
deadnoob1213 is not online. deadnoob1213
Joined: 11 Oct 2011
Total Posts: 8690
16 Nov 2014 02:15 AM
maybe try onTouch
Report Abuse
Joshua7851 is not online. Joshua7851
Joined: 18 Nov 2012
Total Posts: 210
16 Nov 2014 02:18 AM
It doesen't matter what the name is, it just says that it is a nil value, but it DOES have a value!

script.Parent.Touched:connect(function(p)
if p.Parent.Humanoid~= nil then
local playerpl = game.Players:GetPlayerFromCharacter(p) --Value.
local shopgui = game.Lighting.ShopGui:Clone()
shopgui.Parent = playerpl.PlayerGui --Says that the value doesn't exist
end
end)
Report Abuse
Tedgary009 is not online. Tedgary009
Joined: 29 Dec 2009
Total Posts: 339
16 Nov 2014 02:53 AM
local playerpl = game.Players:GetPlayerFromCharacter(p.Parent) ?


or either


local human = p.Parent:FindFirstChild("Humanoid")
if p.Parent.Humanoid ~= nil then
Report Abuse
Tedgary009 is not online. Tedgary009
Joined: 29 Dec 2009
Total Posts: 339
16 Nov 2014 02:53 AM
i mean

if human ~= nil then
Report Abuse
Deafgift100 is not online. Deafgift100
Joined: 09 May 2010
Total Posts: 3958
16 Nov 2014 03:13 AM
why dont you do game.Players[hit.Parent.Name]?
Report Abuse
thermonuklear is not online. thermonuklear
Joined: 19 Oct 2014
Total Posts: 484
16 Nov 2014 03:17 AM
local playerpl = game.Players:GetPlayerFromCharacter(p.Parent)*
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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