Okay, so i've made a fireball script for a dragon. When test it, on output it says did you forget a colon? The first argument of WaitForChild must be an Object. And here's the script:
sp = script.Parent head = script.Parent.WaitForChild("Head") function fire() f = Instance.new("Part") f.Name = "fireball" f.Shape = "Ball" f.BrickColor = BrickColor.new("Bright blue") f.TopSurface = "Smooth" f.BottomSurface = "Smooth" f.Size = Vector3.new(3,3,3) f.CanCollide = false f.CFrame = head.CFrame f.Velocity = head.CFrame.lookVector*math.random(60,100) g = Instance.new("Fire", fireball) g.Heat = 5 g.Color = Color3.new(255,0,0) g.SecondaryColor = Color3.new(85,85,85) fireball.Parent = game.Workspace end while true do wait() fire() end
WaitForChild
is a method. Methods use a :
instead of .
:
head = script.Parent:WaitForChild("Head")
Other typo: You use fireball
in two places; fireball
was never defined. Those should be replaced with f
which is used everywhere else.
Color3s are not BrickColors. Use Color.new(r,g,b)
to make Color3 values. Note that the range of R, G, and B are [0, 1] not [0,255] like that shown in the properties window. Divide each value by 255 to get the correct decimal.
You forgotten to Anchored the fireball and to make it shoot do this Make sure the fireball is to the dragon mouth like CFrame it to the dragon mouth for i = 1,100 do f.CFrame = f.CFrame *CFrame.new(0,0,-5) wait(0.03) end
Why is it looped, That will lag out your game. Also, it would not fly if you fixed your problem, use this instead.
bv = Instance.new("BodyVelocity") bv.maxForce = Vector3.new(math.huge,math.huge,math.huge) bv.velocity = part.CFrame.lookVector*speed