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
 

Attempt to call a nil value

Previous Thread :: Next Thread 
awesomejj101 is not online. awesomejj101
Joined: 16 Aug 2009
Total Posts: 97
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
Architect2498 is not online. Architect2498
Joined: 21 Jun 2013
Total Posts: 656
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
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