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

How do you make flames 'wrap around' an object which it can't go through? (Like a real flamethrower)

Asked by 10 years ago

So I have this flamethrower... And honestly, it's not that great. Here's the coding I go for it so far:

switch = script.Parent
on = switch.isOn
bin = switch.Parent
local spawn = bin.Pilot
deb = false
switch.BrickColor = BrickColor.new("Bright red")
on.Value = false

while true do
wait(0.1)
if on.Value == true then
p = Instance.new("Part")
p.Name = "Fire"
p.Size = Vector3.new(3,3,3)
p.Shape = "Ball"
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.Transparency = 0.5
p.Anchored = false
p.CanCollide = false
p.CFrame = spawn.CFrame
script.Move:Clone().Parent = p
wait(0.05)
spawn.TouchEnded:connect(function(part) -- This is my failed improvisation for it to try and go round.. This whole section can be rid of if there's a better way for my question.
    wait(0.1)
    p.CanCollide = true
    wait(1.2)
    p.CanCollide = false -- I did this because it keeps rebounding, but no matter what I do, it won't stop. It's also gets the affect of gravity, how can I stop that?
    spawn.Touched:connect(function(part)
        p.CanCollide = false
wait (0.1)
p.CanCollide = false
    end)
end)


---
rand = math.random(1,3)
if rand == 1 then p.BrickColor = BrickColor.new("Bright red")
elseif rand == 2 then p.BrickColor = BrickColor.new("Bright orange")
elseif rand == 3 then p.BrickColor = BrickColor.new("Bright yellow")
end
---

---
p.Parent = game.Workspace
end
end

Thx. Hope you can help me ;3 This is also linked to this question: https://scriptinghelpers.org/questions/13068/how-to-make-a-flamethrower-make-something-catch-fire-then-kill-the-flames-after-around-10-seconds

Answer this question