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

Is it possible to use Resize() and make it dont stops if it hits a part ?

Asked by 6 years ago
Edited 6 years ago

I'm working on a game and i created a "Beam" attack. So, to make the beam grow forward, i used Resize(). The only problem, is that i put a script in the beam in which i used .Touched event. Because of that, the beam wont go throught parts (I tried without and it works but when i use .Touched, it does nothing) . How can i make Resize() continue even if it hits a part ?

Event script :

local beam = script.Parent
beam.Touched:connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") then
        local humanoid = part.Parent:FindFirstChild("Humanoid")
        humanoid:TakeDamage(10)
    end
end)

Beam Script

local beam = script.Parent
for i = 1,25  do
    beam:Resize(5, 2)
    wait(0.01)
end

1 answer

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

Try setting it's CanCollide property off

but that may effect your Touched event

personally I would tween the size instead because collisions won't stop it from growing.

0
make my answer accepted right now AdventurousHeight 5 — 6y
0
tween lags in game, for my beam attack I used resize and then i constantly shot out a damage part instead of having the actual beam cause damage Earthkingiv 51 — 6y
0
also keep the beam can't collide Earthkingiv 51 — 6y
Ad

Answer this question