The part won´t follow the mouse!

so, i made a script that the part should follow the mouse. but it doesent
its in a local script btw

local script:

local part = script.Parent
local player = game.Players.LocalPlayer

function movePartToMouse(part, player)
	local mouse = player:GetMouse()
	part.CFrame = CFrame.new(part.Position, mouse.Hit.p)
end

game:GetService("RunService").RenderStepped:Connect(function()
	movePartToMouse(part, player)
end)

Local scripts don’t work in workspace (assuming the part is in workspace).

Try placing the script in StarterGUI or StarterPlayerScripts.

3 Likes

You could also make it a normal script and change the RunContext to Local

2 Likes

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