Hello everyone! I am trying to make a simple building blocks script in Roblox Studio, although I made it I have found that the part which is a display before its placed can even be placed in the air. And I want it always to be on the surface of baseplate.Does anyone know how to do that?
Here is the script:
local unitRay = mouse.UnitRay local origin = mouse.Origin local part = game.ReplicatedStorage.Part:Clone() mouse.Move:Connect(function() part.Parent = workspace part.CFrame = mouse.Hit part.Orientation = Vector3.new(0,0,0) part.Transparency = 0.5 part.Name = "notplacedpart" part.Anchored = true part.CanCollide = false print(mouse.Hit) end) mouse.Button1Down:Connect(function() local part = Instance.new("Part",workspace) part.CFrame = game.Workspace:WaitForChild("notplacedpart").CFrame part.Orientation = Vector3.new(0,0,0) part.Anchored = true end)``` And I also want it to not be more than 15 studs away from the player or you cannot place the block.