Script doesn't work for some reason

Okay, never mind, I tried to do what you mean, but it’s easier for me to show you what you mean:

This script is just a test for you to learn how “Placement” really works, if you want to learn more about it, there is already a module ready to be used, Creating A Furniture Placement System

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RunService = game:GetService("RunService")

local MaxDistance = 0.01 --["RenderDistanceBox 0. 0. 1. X"] [ "Recommend 0.01" ]

local DummyBlock = game.ReplicatedStorage.Block:Clone()
DummyBlock.Parent = workspace
DummyBlock.Transparency = 0.5
DummyBlock.CanCollide = false

local function roundToStep(initialValue,step)
	local roundedValue = math.floor(initialValue/step)*step
	return roundedValue
end

RunService.RenderStepped:Connect(function()
	DummyBlock.Position = Vector3.new(roundToStep(Mouse.Hit.Position.X, MaxDistance), 1, roundToStep(Mouse.Hit.Position.Z, MaxDistance))
end)

Mouse.Button1Down:Connect(function()
	local Block = game.ReplicatedStorage.Block:Clone()
	Block.Parent = workspace
	Block.Position = Vector3.new(roundToStep(Mouse.Hit.Position.X, MaxDistance), 1, roundToStep(Mouse.Hit.Position.Z, MaxDistance))
end)

Block.rbxm (4,0,KB)

1 Like