Trouble with Beams

Hello!

I apologize if this is the wrong category, I wasn’t really sure. The goal is to create a “Swinging” mechanic, this is done by making a rope locally that is invisible to other players, then creating a beam server-side so other players can see the rope as a beam.

The rope works perfectly, the problem is the beam. Mouse.Hit.p is ignoring specific parts and going straight to the baseplate, glitching the beam through buildings.

What I want to happen:

What is happening:

If you used the Ray statement, Then you can use the Whitelist and Blacklitst parameters.

To read an understand more read this article:

2 Likes

Still haven’t solved the problem, but found a solution that will work for now.

I’m communicating mouse.Hit through a remote event to the server, and somewhere along the way the value changes between local and server for mouse hit position. I essentially just re-routed the mouse.Hit position through another way which works fine

(Still annoying not knowthing the solution but whatever lol)

2 Likes

Do you want something like that?

1 Like

Yep!

You can see I have something similar, however mouse.Hit.p ignores the building completely and acts as if it’s on TargetFilter.

1 Like

maybe send the script so i can look if i can find something

1 Like

local side:

local function beamFunc ()

	game.ReplicatedStorage.Events.Remotes.BeamHandle:FireServer(true,char,mouse.Target,mouse.Hit.p)
	
end

Server Side:

local function onEvent (plr,on,char,mouseTarget,mouseHit)
	local folder = game.Workspace:WaitForChild(plr.Name.."Folder")
	
	if on then
		-- Make Beam
		local beam = Instance.new("Beam",folder)
		
		local hand = char.RightHand
		local pos1 = mouseHit
		local pos2 = Vector3.new(hand.Position.X,hand.Position.Y,hand.Position.Z)

		attach1 = Instance.new("Attachment")
		attach2 = Instance.new("Attachment")
		
		attach1.Parent = mouseTarget
		attach1.WorldPosition = pos1
		
		attach2.Parent = hand
		attach2.WorldPosition = pos2
		
		beam.Attachment0 = attach1
		beam.Attachment1 = attach2
		configBeam(beam)
	else
		-- Destroy Beam
		folder.Beam:Destroy()
		attach1:Destroy()
		attach2:Destroy()
	end
end

game.ReplicatedStorage.Events.Remotes.BeamHandle.OnServerEvent:Connect(onEvent)

I’m creating a rope on local side so it is hidden from other players, but that uses the exact same method as i do for server side which is weird.

and you only want it for the local site?

No, I should explain my goals better;

The goal is to create a “Swinging” mechanic, this is done by making a rope locally that is invisible to other players, then creating a beam server-side so other players can see the rope as a beam.

The rope works perfectly, the problem is the beam. Mouse.Hit.p is ignoring specific parts and going straight to the baseplate, glitching the beam through buildings.

For anyone having a similar problem like this, there was no solution for me. It was simply a glitch affecting my place only. I opened up a new project using the exact same code and it works just fine.