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: FindFirstChild Help

Previous Thread :: Next Thread 
SenjuNaruto is not online. SenjuNaruto
Joined: 16 Feb 2012
Total Posts: 368
19 Jun 2013 05:31 PM
Hey guys, I'm having a problem with this script. This is the error I get:
Workspace.Handle.Script:14: attempt to compare number with userdata
-The name of the brick is Handle for some reason
- This is a normal script.

math.randomseed(tick())
WalkSpeed = 20
function Smash (Part)
script.Disabled = false
if game.Players:GetPlayerFromCharacter(Part.Parent) ~= nil then
Player = game.Players:GetPlayerFromCharacter(Part.Parent)
Char = Part.Parent
Char.Humanoid.WalkSpeed = WalkSpeed
f = Instance.new ("Fire")
f.Size = 25
f.Parent = Part.Parent.Torso
r = Part.Parent.Torso:FindFirstChild("Fire")
if r > 1 then ----- Problem line.
r:remove()
s = Instance.new ("Sparkles")
s.Parent = Part.Parent.Torso
v = Part.Parent.Torso:FindFirstChild("Sparkles")
if v > 1 then
v:remove()
for i= 1,30 do------ "You can ignore beyond here."
f.Size = f.Size - 1
wait(0.25)
end
while true do
a = math.random(225)
b = math.random(225)
c = math.random(225)
f.Color = Color3.new(a/255,b/255,c/255)
s.Color = Color3.new(a/100,b/100,c/100)
wait(0.25)
end
wait(5)
script.Disabled = true
end
end
end
end
script.Parent.Touched:connect(Smash)
Report Abuse
cowboy123134 is not online. cowboy123134
Joined: 20 Jun 2009
Total Posts: 21682
19 Jun 2013 05:33 PM
math.randomseed(tick())
WalkSpeed = 20
function Smash (Part)
script.Disabled = false
if game.Players:GetPlayerFromCharacter(Part.Parent) ~= nil then
Player = game.Players:GetPlayerFromCharacter(Part.Parent)
Char = Part.Parent
Char.Humanoid.WalkSpeed = WalkSpeed
f = Instance.new ("Fire")
f.Size = 25
f.Parent = Part.Parent.Torso
r = Part.Parent.Torso:FindFirstChild("Fire")
if r ~= nil then ----- Problem line.
r:remove()
s = Instance.new ("Sparkles")
s.Parent = Part.Parent.Torso
v = Part.Parent.Torso:FindFirstChild("Sparkles")
if v > 1 then
v:remove()
for i= 1,30 do------ "You can ignore beyond here."
f.Size = f.Size - 1
wait(0.25)
end
while true do
a = math.random(225)
b = math.random(225)
c = math.random(225)
f.Color = Color3.new(a/255,b/255,c/255)
s.Color = Color3.new(a/100,b/100,c/100)
wait(0.25)
end
wait(5)
script.Disabled = true
end
end
end
end
script.Parent.Touched:connect(Smash)
Report Abuse
SenjuNaruto is not online. SenjuNaruto
Joined: 16 Feb 2012
Total Posts: 368
19 Jun 2013 05:46 PM
Thank you for you input. However with your solution comes another problem. I should tell you, what I want the script to do is insert a fire and sparkles into the character torso 1 time when the brick (Parent) is touched. With your solution, the sparkles come but the fire doesn't and the same error output moves to line 19 (v > 1). i've tried making them both "~=" but then the script doesn't work all together. If you changed something in the script I missed then please tell.
Report Abuse
cowboy123134 is not online. cowboy123134
Joined: 20 Jun 2009
Total Posts: 21682
19 Jun 2013 05:48 PM
That's all I changed.

Do you want it to add sparkles if it finds "Fire"?

Or do you want it to NOT add sparkles if it finds "Fire"?
Report Abuse
justin2865 is not online. justin2865
Joined: 30 Dec 2011
Total Posts: 4677
19 Jun 2013 05:52 PM
math.randomseed(tick())
WalkSpeed = 20
function Smash (Part)
script.Disabled = false
if game.Players:GetPlayerFromCharacter(Part.Parent) ~= nil then
Player = game.Players:GetPlayerFromCharacter(Part.Parent)
Char = Part.Parent
Char.Humanoid.WalkSpeed = WalkSpeed
f = Instance.new ("Fire")
f.Size = 25
f.Parent = Part.Parent.Torso
r = Part.Parent.Torso:FindFirstChild("Fire")
if r ~= nil then
r:remove()
c = Part.Parent.Torso
s = Instance.new ("Sparkles", c)
v = Part.Parent.Torso:FindFirstChild("Sparkles")
if v ~= nil then
v:remove()
for i= 1,30 do------ "You can ignore beyond here."
f.Size = f.Size - 1
wait(0.25)
end
while true do
a = math.random(225)
b = math.random(225)
c = math.random(225)
f.Color = Color3.new(a/255,b/255,c/255)
s.Color = Color3.new(a/100,b/100,c/100)
wait(0.25)
end
wait(5)
script.Disabled = true
end
end
end
end
script.Parent.Touched:connect(Smash)
Report Abuse
SenjuNaruto is not online. SenjuNaruto
Joined: 16 Feb 2012
Total Posts: 368
19 Jun 2013 05:58 PM
Thanks for your input justin, but your script also doesn't spawn any fire or sparkles and @cowboy I want it to add 1 Fire and 1 Sparkles. I put those remove lines in because before it was putting too much Fire and Sparkles into the Torso, which broke the Color lines. Essentially however, yes. Since sparkles does come after the fire, I could also be put in if it finds Fire.
Report Abuse
SenjuNaruto is not online. SenjuNaruto
Joined: 16 Feb 2012
Total Posts: 368
19 Jun 2013 06:30 PM
bumpin
Report Abuse
justin2865 is not online. justin2865
Joined: 30 Dec 2011
Total Posts: 4677
19 Jun 2013 06:38 PM
Try this.


math.randomseed(tick())
WalkSpeed = 20
function Smash (Part)
script.Disabled = false
if game.Players:GetPlayerFromCharacter(Part.Parent) ~= nil then
Player = game.Players:GetPlayerFromCharacter(Part.Parent)
Char = Part.Parent
Char.Humanoid.WalkSpeed = WalkSpeed
l = Part.Parent.Torso
f = Instance.new ("Fire", l)
f.Size = 25
f.Heat = 0
c = Part.Parent.Torso
s = Instance.new ("Sparkles", c)
for i= 1,30 do------ "You can ignore beyond here."
f.Size = f.Size - 1
wait(0.25)
end
while true do
a = math.random(225)
b = math.random(225)
c = math.random(225)
f.Color = Color3.new(a/255,b/255,c/255)
s.Color = Color3.new(a/100,b/100,c/100)
wait(0.25)
end
wait(5)
script.Disabled = true
end
end
end
end
script.Parent.Touched:connect(Smash)
Report Abuse
SenjuNaruto is not online. SenjuNaruto
Joined: 16 Feb 2012
Total Posts: 368
19 Jun 2013 08:36 PM
No...
Report Abuse
SenjuNaruto is not online. SenjuNaruto
Joined: 16 Feb 2012
Total Posts: 368
19 Jun 2013 09:52 PM
one more bump guys
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