I am making a building and destroying system, but when I try to destroy the part it doesn’t destroy it even though when I check if a value is false and I know it is false it won’t pass the if statement, am I missing something very obvious?
local function destroyBlock()
print(isPlacing, canPlace) -- when I print it it is equal to false, yet it doesn't pass the if statement below
if isPlacing and canPlace == false then
print("sdfg") -- this won't print
if mouse.Target ~= nil then
if mouse.Target.Parent == workspace.Blocks then
if (player.Character.HumanoidRootPart.Position - mouse.Target.Position).magnitude <= 18 then
mouse.Target:Destroy()
end
end
end
end
end
mouse.Button1Up:Connect(destroyBlock)
What is isPlacing printing? In the if statement you are checking if isPlacing is true and canPlace is false. Are both of them false because if you want to check if both of them are false then you would do: if isPlacing == false and canPlace == false then