Here's my problem, the script works, but when you click a block (the FireServer) deletes the block that you click and creates new bricks around it. You have to move the mouse for the function to run again, is there a way where I wouldn't have to do that?
--Variables
local blockValues = game.ServerStorage.Configuration.block_Values
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local target
local selected_Block = "None"
local selected_Position
local equipped = false
--Functions
function checkBlock(pos)
game.ReplicatedStorage.createBlock:FireServer(pos)
end
--MainScripts
script.Parent.Equipped:connect(function()
equipped = true
mouse.Move:connect(function()
if equipped then
if mouse.Target then
target = mouse.Target
if target:FindFirstChild("Type") then
if selected_Block == tostring(mouse.Target.Name) then
print("Same Block!")
else
print("Different Block!")
selected_Block = mouse.Target.Name
selected_Position = mouse.Target.Position
end
end
end
end
end)
end)
script.Parent.Unequipped:connect(function()
equipped = false
end)
mouse.Button1Down:connect(function()
if equipped then
if mouse.Target:FindFirstChild("Type") then
checkBlock(selected_Position)
end
end
end)

1 comment
Thank you it did!