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

Extending A Part Through Another Part Via Script?

I want to make a tool that creates a part that goes forward in front of the players character. I've already done that all myself (very slowly, but I did it), but I have one problem with it. Whenever it extends the part (using Part.Size = Part.Size + Vector3.new(1, 0, 0)) and the part comes into contact with another part that's anchored into workspace (like a mountain in the map), it just goes above the part in workspace. I would like it to go through the other part, but I have no idea how to do this. I already made the part's cancollide false.

Here's a sample of the code so that it's not too long:

function onUsed()
	script.Parent.Enabled = false
	local clone = beam:clone()
	clone.Parent = game.Workspace
	clone.Position = torso.Position + torso.CFrame.lookVector * 1.75
	clone.Orientation = torso.Orientation + Vector3.new(0, 90, 0)
	clone.Size = clone.Size + Vector3.new(1, 0, 0)
	renstep:wait()

and it basically repeats that a ton while increasing the multiple for torso.CFrame.lookVector. the local beam is the part I created, it's anchored and cancollide is false. The script is inside a tool which is why it makes enabled false.

Here's a gif to see what I mean when I say the part goes over things: https://giphy.com/gifs/FWvhZuwsun2KI

2 comments

0

So you want a part that goes in front of you when you equip a tool?

0

I already have a part that goes infront of me when I use a tool, I want the part to go through blocks infront of it when it extends. Sorry, I'm bad at explaining things.

1 answer

clone.CanCollide = false

This allows it to go through things

1 comment

0

It's already cancollide = false, but when I move it with clone.Position and clone.Size and there's something in the way, it just goes above the object in the way instead of going through it. I edited my question with a gif of what I mean.

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