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 7 years ago
Edited 7 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 :

1local beam = script.Parent
2beam.Touched:connect(function(part)
3    if part.Parent:FindFirstChild("Humanoid") then
4        local humanoid = part.Parent:FindFirstChild("Humanoid")
5        humanoid:TakeDamage(10)
6    end
7end)

Beam Script

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

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 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 — 7y
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 — 7y
0
also keep the beam can't collide Earthkingiv 51 — 7y
Ad

Answer this question