Why wont Mouse.Hit work?

Hello fellow developers! I am trying to make a very simple script to test out the Mouse.Hit thing because I have never used that before, but this doesn’t seem to be working. The purpose of the script is to make a new part where the player clicks. Down bellow I have put the Explorer and the Script. Please help me!

local Players = game:GetService("Players")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local tool = script.Parent

tool.Activated:Connect(function()
	local part = Instance.new("Part", workspace)
	part.Position = mouse.Hit.Position
	
	
end)


StarterPackToolScript

The script you have is a serverscript, for mouse and local player to be used it must be a localscript

1 Like

Normal Scripts can’t access the LocalPlayer ('s Mouse)

1 Like

Oh my god… im so stupid haha, thanks so much!

thanks! lol i didnt realize this

Wait actaully, I just tried it and it didnt seem to work. There is no error in the output

Go to the tool and deselect "Requires handle’

1 Like

Yes! Finally thanks so much! This means that I can start making horrible and evil creations! Why would you give me this power? What foolish person would do that? I am thankful but the rest of the world probably isnt lol. anyways thanks again

1 Like

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