Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

3 comments

0

make my answer accepted right now

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

0

also keep the beam can't collide

This discussion is preserved as it was. New answers, comments, and votes are closed.