|
| 14 Jul 2013 12:07 AM |
function onHit(hit) local user = game.Players:findFirstChild(hit.Parent.Name) local message = script.Parent.Message:clone() local health = script.Parent.Health:clone() local heath8 = script.Parent.Health8:clone() local health6 = script.Parent.Health6:clone() local health4 = script.Parent.Health4:clone() local health2 = script.Parent.Health2:clone() local health0 = script.Parent.Health0:clone() if user then while true do wait() if script.Parent.Parent.a1.Transparency == 0 then health.TextLabel.Text = "Text1" message.TextLabel.Text = "Text2" health.Parent = user.PlayerGui message.Parent = user.PlayerGui
if script.Parent.Parent.Bar1.Transparency == 1 then health8.TextLabel.Text = "Text1" message.TextLabel.Text = "Text2" health8.Parent = user.PlayerGui message.Parent = user.PlayerGui
if script.Parent.Parent.a2.Transparency == 1 then health6.TextLabel.Text = "Text1" message.TextLabel.Text = "Text2" health6.Parent = user.PlayerGui message.Parent = user.PlayerGui
if script.Parent.Parent.a3.Transparency == 1 then health4.TextLabel.Text = "Text1" message.TextLabel.Text = "Text2" health4.Parent = user.PlayerGui message.Parent = user.PlayerGui
if script.Parent.Parent.a4.Transparency == 1 then health2.TextLabel.Text = "Text1" message.TextLabel.Text = "Text2" health2.Parent = user.PlayerGui message.Parent = user.PlayerGui
if script.Parent.Parent.a5.Transparency == 1 then health0.TextLabel.Text = "Text1" message.TextLabel.Text = "Text2" health0.Parent = user.PlayerGui message.Parent = user.PlayerGui
script.Parent.TouchEnded:connect(function() message:remove() health:remove() health8:remove() health6:remove() health4:remove() health2:remove() health0:remove() end) end end end end end end end end end
script.Parent.Touched:connect(onHit) ----------------------------------------------------------------------------------------- Output: Attempt to call a nil value! Disconnected event because of exception (Dumb output where is the nil value...! >:C)
Gui touch brick with if statements.... |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2013 12:31 AM |
I would use 'elseif' instead of lots and lots of 'if.
You need to close every function wherever you want it to finish, you cant make like 5 arguments and close them at the same time. It should be like this:
if () then end
elseif () then end
elseif () then end
And so on
Randall Boggs = Doom Bucket > 7 > Blu > Emp+Est |
|
|
| Report Abuse |
|
|