Connecting a Beam from part to Character Torso locally

Hey again,

So I’m trying to make a local script where if you are within a certain distance, a beam will connect from a specific part to your R15 Front UpperTorso attachment.
image

I tried a couple of scripts (and searched on the forum and google), but couldn’t find specifically what I’m looking for. Any help will be much appreciated.

I created the local script you need, I hope you are satisfied.
Put it in game.StarterPlayer.StarterCharacterScripts

script.Parent:WaitForChild("UpperTorso")
local beam = Instance.new("Beam", script.Parent.UpperTorso)
beam.Attachment0 = script.Parent.UpperTorso:FindFirstChild("BodyFrontAttachment")

while true do
	wait(0.2)
	if (script.Parent.UpperTorso.Position - workspace.Part.Position).Magnitude <= 10 then
		beam.Attachment1 = workspace.Part.Attachment
	else
		beam.Attachment1 = nil
	end
end

2 Likes

Hey, thanks for the response!

While I did try this, and it did work, it wouldn’t really work for the things I’m making (doors), being that there are difference sizes of them, and having the distance be changed depending on the door.
Is there any way so it’s made for a local script in a part, so all of them can be different.
Unless I’m missing something and it would work for that…