Part look at mouse

Its supposed to be in a local script, copy and paste the code I gave you as I made some changes. Open your output if it does not work and let me know what it says.

Still doesnt work, and no error message.

I’m pretty much convinced at this point there’s something wrong on your end, since these are all valid solutions. Maybe show us the actual scripts and how your game hierarchy looks like

This it… The script that Abroxus made.

local part1 = game.Workspace.Part1 
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

mouse.Move:Connect(function()

	part1.CFrame = CFrame.lookAt(part1.Position, mouse.Hit.p)

end)

Yes but that’s probably just an example script. I mean is your tank turret really named Part1? Do you have anything that would interfere with this? Where did you place the script? Are you sure you are referencing the correct part?

1 Like

This can’t work, mouse.Position would not give the position of the mouse icon in the 3d world, but it would give the position of the mouse icon on the screen.

Yes, for now the turret is Part1. I doubt there would be anything that interferes with this, I am refrencing the part…

The what do you suggest?


Am not sure how you would do this. It would be pretty complicated.

Well where is the script and where is the part?

The script is in the part and the part ins in the workspace.

Do you know any resources that I should check out to make a turret?

That’s why it doesn’t work. The local script needs to be in StarterPlayerScripts it won’t work in workspace

(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)

We can’t build a game for you so you should look to resources such as YouTube and the Roblox documentation. If my answer works for you, you can mark it as a solution so other developers know that the question has been solved.

I didn’t mean it like that…


I know you didn’t but the developer forum is made for specific problems that you won’t find an answer to somewhere else. Before asking for more scripts you should make sure your problem hasn’t been answered yet. Also deleting your message that indicates that this issue has been resolved helps just about nobody.

Hello, i do know how to make a part look at a players mouse but when it hovers on the baseplate it looks at the baseplate not the mouses position, how do i make a part ignore the baseplate

create a script in StarterPlayerScripts, then add this,

local part = workspace.Part1 
local mouse = game.Players.LocalPlayer:GetMouse()

game["Run Service"].RenderStepped:Connect(function()
	part.CFrame = CFrame.new(part.Position, mouse.Hit.Position)
end)