|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
| |
|
| |
|