How do I make things go to a player's mouse

I know that the player’s mouse in 3d space cframe wise is mouse.hit. But whenever I try to use mouse.hit, it doesnt work. Such as I made a tool that is supposed to fire stuff out of the player’s mouse, but it doesnt work. So I’m confused. Am I missing something?

This is the link to the other post i was talking about

1 Like

If you are referring to the script in that post I don’t think you can do local Mouse.hit because it will only do that once and stay in that position, you have to fire mouse.hit to locate the mouse position ever Rendered step. I can make a code that moves an object to the player mouse if you want an example

1 Like

I don’t think you need to do it every rendered step, you can just do hit = Mouse.hit before you call the remote event, therefore changing the mouse coordinates for the location of the mouse when you “fired”

1 Like

I was talking about you need to do the render step if you want the object to follow the mouse, else just fire when you click.

also, what do you mean by

Like the location of the mouse? or like a basketball, from the player in an arc towards the mouse position.

This is code that will make a block at the player mouse relative to the position of the camera.

local Debris = game:GetService("Debris")

local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()

local CanFire = true

function Fire()
	if CanFire == true then
		CanFire = false
		delay(0.1,function()
			CanFire = true
		end)
		
		local Object = Instance.new("Part",workspace)
		Object.Anchored = true
		Object.CFrame = Mouse.Hit --- this is what I mean by fire Mouse.Hit every time you fire
		Object.Size = Vector3.new(1,1,1)
		Object.Material = "Neon"
		
		Debris:AddItem(Object,5)
		
	end
end

Mouse.Button1Down:Connect(Fire)

Well im firing a remote event and sending “hit” and when i set the part’s cframe to “hit” the part didnt go to the mouse

“hit” is mouse.hit

Nevermind i figured it out