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 |
|
|
|
| 30 Jan 2014 07:45 PM |
| Is Player ever defined? Is Player actually a character that actually has a Humanoid? |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 30 Jan 2014 07:49 PM |
GetPlayerFromCharacter(chr)
|
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 30 Jan 2014 08:00 PM |
Jesus christ this kid is stupid
if hit.Parent:findFirstChild("Humanoid") then --stuff end |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 10 Dec 2008 |
| Total Posts: 13886 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 10 Dec 2008 |
| Total Posts: 13886 |
|
| |
|
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 |
|
|