How do i make this script work?

loop = true
db = false
local Part = script.Parent.Handle
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Tool = script.Parent

Tool.Equipped:Connect(function()
	while loop == true do
	Part.CFrame = CFrame.new(Part.Position, Mouse.Hit.Position)
	task.wait()
	end
end)

I want to make my character face where my mouse is. However others cannot see it due to the fact that the code is on a local script. The problem with converting to a server script is that server scripts cannot use GetMouse(). How can I make this script work on a serverscript?

1 Like
--local
loop = true
db = false
local Part = script.Parent.Handle
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Tool = script.Parent

Tool.Equipped:Connect(function()
	while loop == true do
		script.Parent.RemoteEvent:FireServer(script.Parent.Handle,Mouse.Hit.Position)
		task.wait()
	end
end)


--Script
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr,part,mouse)
	part.CFrame = CFrame.new(part.Position, mouse)
end)

Just to declare, Mouse is kind of deprecated.