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: Electric fence

Previous Thread :: Next Thread 
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
18 Feb 2014 07:13 PM
When the part is touched the walkspeed changes to 0 that works but the charters parts not anchoring/changing color don't work. I am not sure why :/

sp = script.Parent

sp.Touched:connect(function(player)
local die = player.Parent:FindFirstChild("Humanoid")
local parts = player.Parent:FindFirstChild(ClassName == "Part")
if (die ~= nil) then
die.WalkSpeed = 0
parts.Anchored = true
parts.BrickColor = "Black"
wait()
Parts.Reflectance = 0.6
wait(2)
die.Health = 0
end end)

Here is the output:
19:10:12.424 - Workspace.Block.Script:8: attempt to index local 'parts' (a nil value)
19:10:12.428 - Script 'Workspace.Block.Script', Line 8
19:10:12.428 - stack end
19:10:12.429 - Disconnected event because of exception

insertCreativeSiggyHere
Report Abuse
mycheeze is online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
18 Feb 2014 07:17 PM
Hello nocnoc bb <3

the 4th line of code to the end uses a capitol "P" and the others do not.
Report Abuse
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
18 Feb 2014 07:18 PM
ty <3

insertCreativeSiggyHere
Report Abuse
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
18 Feb 2014 07:19 PM
still doesn't work

output:
19:19:10.944 - Workspace.Block.Script:8: attempt to index local 'parts' (a nil value)
19:19:10.944 - Script 'Workspace.Block.Script', Line 8
19:19:10.944 - stack end
19:19:10.945 - Disconnected event because of exception

insertCreativeSiggyHere
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
18 Feb 2014 07:20 PM
"local parts = player.Parent:FindFirstChild(ClassName == "Part")
"

pretty sure findFirstChild doesn't work like this.

#nerdsunited
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
18 Feb 2014 07:20 PM
"parts.BrickColor = "Black"" needs to be:
parts.BrickColor = BrickColor.new ('Black')

Also, you never defined parts.
Report Abuse
nocnoc1 is not online. nocnoc1
Joined: 30 Jan 2011
Total Posts: 2193
18 Feb 2014 07:21 PM
I tried IsA

insertCreativeSiggyHere
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
18 Feb 2014 07:22 PM
Oh, you did, but not correctly. If you want to get all the children named 'Part' in the model, then use :GetChildren and in pairs.

for i,parts in pairs (script.Parent:GetChildren ()) do
--stuff
end
Report Abuse
mycheeze is online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
18 Feb 2014 07:22 PM
I think you need to edit the brick color and do a
brickcolor = brickcolor3.new "wutever m8"

and I also noticed the 6th line of code (the one Identifying the local parts)

I think you should do

local parts = player.Parent:FindFirstChild("Part")
Report Abuse
mycheeze is online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
18 Feb 2014 07:24 PM
Woopsies, I meant 'Color3.new'
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
18 Feb 2014 07:25 PM
local parts = player.Parent
if parts.className=='BasePart'

ii
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