Mouse.Hit.Position not accurate?

Hey, im doing a script for an arm to follow your cursor when an event is fired, but for some reason the m.Hit.Position.X/Z isnt very accurate.

image

as you can see in the image its kinda offsetted a bit, i tried to add to the position (Vector3.new(m.Hit.Position.X,0,m.Hit.Position.Z) + Vector3.new(x,x,x)), but it was so buggy, is there any fix to this?

Heres the code:
local plr = game.Players.LocalPlayer
local m = plr:GetMouse()
local runService = game:GetService("RunService")
local rs = game.ReplicatedStorage

local arm = rs.Assets.Arm
local remoteStart = rs:WaitForChild("Events"):WaitForChild("ArmFollowStart")
local remoteStop = rs:WaitForChild("Events"):WaitForChild("ArmFollowStop")

local following = false

local function Follow()

	local armClone = arm:Clone()
	armClone.Parent = workspace.Arm

	local mPosX = m.Hit.Position.X
	local mPosZ = m.Hit.Position.Z

	while following do
		mPosX = m.Hit.Position.X
		mPosZ = m.Hit.Position.Z
		local targetPosition = Vector3.new(mPosX, 0, mPosZ)
		armClone:MoveTo(targetPosition)
		task.wait()
	end
end

remoteStart.OnClientEvent:Connect(function()
	following = true
	Follow()
end)

remoteStop.OnClientEvent:Connect(function()
	following = false
	workspace.Arm:ClearAllChildren()
end)

Ty!

Hello!

If (I assume) the model has a primary part, I think it placed it in the primary part’s position.

Have a nice time!

IM SO DUMBBBB, its what you said, tysm, have nice day!

Your not dumb, it’s a small detail that is crucial yet can be missed easily.

I’m glad that the post helped you. Have a nice day/night/morning/evening.

2 Likes

ty, u too!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.