local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Distance = 25
Mouse.Button1Down:Connect(function(Hit)
local part = Instance.new("Part",workspace)
part.Position = Vector3.new(Mouse.Hit.Position - ((Player.Character.Head.Position - Mouse.Hit.Position).magnitude) + 25)
end)
What I am trying to do is restrict the distance of where you can place a brick to 25 studs. Basically, the brick won't place 25 or more studs away from the player. How would I make this work? Right now, it only spawns under me with no errors.

1 comment
This only places the part if you click 25 studs to the player. I wanted the script to be able to click anywhere, but if you do more than 25 studs, it puts the brick inside a 25 stud area.