I am trying to make this script place a block, but when I hit the correct button, nothing happens (Yes selected has a value, game.Lighting.1) Here is the script:

--LocalScript
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local Placing = false
local Already = false
function Place()
	local Xpos = Mouse.Target.Position.X
	local Ypos = Mouse.Target.Position.Y
	local Zpos = Mouse.Target.Position.Z
	local Surface = Mouse.TargetSurface
	local TargetPos = Mouse.Target.Position
	local Selected = game.Players.LocalPlayer.Selected.Value
	local Clone = Selected:Clone()
	Clone.Position = Vector3.new(TargetPos)
	if Surface == 1 then
		Clone.Position = Vector3.new(Xpos, Ypos + 4, Zpos)
	else
		if Surface == 4 then
			Clone.Position = Vector3.new(Xpos, Ypos - 4, Zpos)
		else
			if Surface == 3 then
				Clone.Position = Vector3.new(Xpos - 4, Ypos,  Zpos)
			else 
				if Surface == 0 then
					Clone.Position = Vector3.new(Xpos + 4, Ypos, Zpos)
				else
					if Surface == 2 then
						Clone.Position = Vector3.new(Xpos, Ypos, ZPos + 4)
						if Surface == 5 then
							Clone.Position = Vector3.new(Xpos, Ypos, Zpos - 4)
						else
							print(" ")
						end
					end
				end
			end
		end
	end
end

Mouse.Button2Down:connect(function()
	local Find = Mouse.Target:FindFirstChild("Xplo")
	if not Already then
	Already = true
	Placing = true
	if Find then
	while true do
		wait(1)
		if Placing == true then
			Place()
		else
			print(" ")
		end
	end
	end
	end
	end)

Mouse.Button2Up:connect(function()
	Already = false
	Placing = false
end)

7 comments

0

You have to clone on the server for it to replicate! Remember to use Remotes

0

What? This does not have FilteringEnabled.

0

I do not condone, nor suggest, non-FE game development. But also it seems like you never parented the clone.

0

Oh. Thanks for that! I keep forgetting!

0

Nevermind, still nothing happens.

0

You put Clone.Parent = game.Workspace and nothing happens? (also a tip: you dont need to put else all those times. you can either make them all seperate if statements and remove all the elses which are currently serving no purpose, or you can combine them to "elseif" and only use one end)

0

I tryed that and it still wont work