I'm making a script that makes that you can place a marker it works but it goes through all the parts and map so it goes out the map

so I want when you press m a marker places here are my local script

 local player = game:GetService('Players').LocalPlayer
local mouse = player:GetMouse()
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(k)
if k == "m" then

---other code comes here but nothing with my problem--

part.Position = Vector3.new(Mouse.Hit.x, Mouse.Hit.y, Mouse.Hit.z)

sorry if you don't understand

2 comments

0

I'm not sure I fully understand the issue.

0

check if Mouse.Hit.Y is less than the surface's Position's Y value