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
 

Re: Still don't get whats wrong with this?

Previous Thread :: Next Thread 
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 07:42 PM
function Touched(hit)
if (hit.Parent == Player.Humanoid)
then for i = 0, 1, 0.1 do
wait(.1)
script.Parent.Parent.Platform.Transparency = i + 0.1, 10
script.Parent.Parent.Platform.CanCollide = false
wait(10)
script.Parent.Parent.Platform.Transparency = 1 - .1, 10
script.Parent.Parent.Platform.CanCollide = true
end
end
end

script.Parent.Touched:connect(Touched)


it says line 2 is trying to index nil value, help?
Report Abuse
CodeTheorem is not online. CodeTheorem
Joined: 03 Jun 2009
Total Posts: 2771
30 Jan 2014 07:45 PM
Is Player ever defined? Is Player actually a character that actually has a Humanoid?
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 07:46 PM
well, i wanted to make sure that whenever its touched, its only a player and not a part.

so i thought that since the player has a humanoid object, i can use that object to be activated.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
30 Jan 2014 07:46 PM
what is Player?
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
30 Jan 2014 07:47 PM
chr=hit.Parent:findFirstChild("Humanoid")
if not chr then return end
Report Abuse
CodeTheorem is not online. CodeTheorem
Joined: 03 Jun 2009
Total Posts: 2771
30 Jan 2014 07:47 PM
No no no, Player, in this instance, would be a VARIABLE. You'd HAVE TO SET IT. And no, Players DO NOT have Humanoids. Players have Characters. Characters have Humanoids.
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 07:47 PM
Uhh the player touching it lol, well what would I do so that the script checks to see if the thing touching it, is a player.
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 07:48 PM
gotcha, so then what would be the correct way to fixing this?
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
30 Jan 2014 07:49 PM
GetPlayerFromCharacter(chr)
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
30 Jan 2014 07:54 PM
Okay... Who ever tried to help this is failing. You are useing big words he probalby doesnt know..


Okay what you did is try to get the player here. Which you cant here.

To make sure it is a player that touches it do this.


if hit.Parent == Humanoid then
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 07:58 PM
it still doesnt work..

function Touched(hit)
if ( hit.Parent == "Humanoid")
then for i = 0, 1, 0.1 do
wait(.1)
script.Parent.Parent.Platform.Transparency = i + 0.1, 10
script.Parent.Parent.Platform.CanCollide = false
wait(10)
script.Parent.Parent.Platform.Transparency = 1 - .1, 10
script.Parent.Parent.Platform.CanCollide = true
end
end
end

script.Parent.Touched:connect(Touched)
Report Abuse
Wakarimasu is not online. Wakarimasu
Joined: 12 Nov 2013
Total Posts: 1448
30 Jan 2014 08:00 PM
Jesus christ this kid is stupid

if hit.Parent:findFirstChild("Humanoid") then
--stuff
end
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
30 Jan 2014 08:01 PM
hit is the part!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


>:/



hit.Parent:findFirstChild("Humanoid") will go to the part's parent which is the player or if not then it's workspace. However, if it finds Humanoid inside the model or workspace then it's probably a player
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 08:05 PM
thanks i guess..
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
30 Jan 2014 08:52 PM
Oh shiz. I forgot to put if find first child I just did parent.humanoid I feel stupid.
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 08:59 PM
I just got another issue,

Trans = Workspace.Button
buttonpressed = false

function Touched(hit)
if hit.Parent:findfirstChild("Humanoid")
then
buttonpressed = true
for i=0, 1, 0.1 do
wait(0.05)
Trans.Transparency = i
Trans.CanCollide = false
wait(10)
for t=1, 0, -0.1 do
Trans.Transparency = t
Trans.CanCollide = true
buttonpressed = false
end

end
end
end

script.Parent.Touched:connect(Touched)

it says findfirstchild is not part of model, it worked on the other script, how come this one doesnt work..

btw i changed it because the other one was unorganized
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 09:03 PM
b1
Report Abuse
yurhomi10 is not online. yurhomi10
Joined: 10 Dec 2008
Total Posts: 13886
30 Jan 2014 09:11 PM
wow, nevermind i made a simple lowercase error. thanks anyways
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