Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

HopperBin Fireball Script Not Working?

Asked by 6 years ago

So, I am making a game with a hopperbin in the starterpack. I used the boulder script from the roblox developer wiki, and made it transparent, but I want it to be on fire too (like fireballs). This is the script, I made the fire, but I can't put it in the thingy that pops up (I tried though). Please help!

lifetime = 5 -- how long the boulder stays there. 5 is a good value.

function onButton1Down(mouse)
    local b = Instance.new("Part")
    local bfire = Instance.new(b."Fire")
    b.BrickColor = BrickColor.new(217)
    b.Transparency = 0
    b.Position = mouse.Hit.p
    b.Size = Vector3.new(5, 5, 5)
    b.Shape = 0
    b.Parent = game.Workspace
    b.Velocity = (script.Parent.Parent.Parent.Character.Head.Position - mouse.Hit.p).unit * -50 + Vector3.new(0, 10, 0)
    -- pushes it away from you, and pops it up a bit, making it seem to come out of the ground.
    game:GetService("Debris"):AddItem(b, lifetime)
end

function onSelected(mouse)
    mouse.Button1Down:connect(function() onButton1Down(mouse) end) -- Button1Down doesn't come with a mouse, seeing as its
    -- an event of the mouse itself. We need to give the function the mouse object to work off of.
end

script.Parent.Selected:connect(onSelected) -- Selected comes with a mouse.


1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Particles are added using Parent into another object in this case you should add:

bfire.Parent = b --Adds bfire into b

The Roblox wiki article:

http://wiki.roblox.com/index.php?title=Custom_particles

http://wiki.roblox.com/index.php?title=API:Class/Instance/Parent

Ps: This is a problem you will stumble upon later, you will have to add the direction:

   local targetPos = game.Players.LocalPlayer.character.Humanoid.TargetPoint
   local lookAt = (targetPos - game.Players.LocalPlayer.character.Head.Position).unit
   b.Velocity = lookAt * 100 -- Fireball Velocity = Direction * Speed
Ad

Answer this question