I have a local script, a remote event to pass information and a server script. I have an attack which is a cylinder with other parts and called beam (model name), and I tried to use CFrame to make my beam face the mouse, which I am confused on. I sometimes get errors about CFrame and Vector3 but sometimes I don't but the beam still doesn't face the mouse, it just stands straight up not moving.

Local Script:

local rp = game:GetService("ReplicatedStorage")
local event = rp:WaitForChild("RemoteEvent")
local player = game:GetService("Players").LocalPlayer
local Mouse = player:GetMouse()


	Mouse.Move:Connect(function()
		local MousePosition = Mouse.Hit
			event:FireServer(MousePosition)
			end
	end)

Server Script:

local rp = game:GetService("ReplicatedStorage")

local event = rp:WaitForChild("RemoteEvent")

event.OnServerEvent:Connect(function(player,mp)
	local beam = player.Character:FindFirstChild("beam")

	beam.PrimaryPart = beam.Cylinder
	beam.Cylinder.CFrame = CFrame.new(player.Character.HumanoidRootPart.Position, mp.Position)
end)

In the output, sometimes there are errors about CFrame and vector3 but sometimes not. But, in the outcome, the beam just stands straight up. I really need help on how to make my beam atleast face the mouse, and I think I did everything right because I used 2 arguments in the CFrame.new. Also, why the local beam is in the player's character is because in another script I made it go in the player's character. I also tried local MousePosition = Mouse.Hit.p or Mouse.Hit.Position, but I just don't know. I don't know how to work the CFrame.new, or what .p means. Please Help!!! My goal is to make an attack at my player's hands and face the mouse when they move it.

1 comment

0

I FOUND THE PROBLEM - MY ATTACK HAD MODELS WHICH WASNT MOVING OR FACING ANYTHING BUT THE CYLINDER WAS, AND THE CYLINDER WAS INVISIBLE. BUT, SOME OTHER PROBLEMS IS THAT THE CYLINDER BARELY TILTS TO THE MOUSE AND OTHER PARTS IN THE MODEL DONT MOVE WITH THE CENTER PIECE EVEN THOUGH THE CYLINDER WAS THE PRIMARY PART