So, i was trying to make a block remover system, but there are a lot of bugs i cant fix.
-
What is the issue? Well, in the script I made, I put some blocks that can’t be broken, and then the bug comes, when I try to break this block and then I try to break a normal block, which technically I would break, the block it just doesn’t break
-
What solutions have you tried so far? I couldn’t find any solution for that, seriously I’ve tried everything and I just can’t. To be quite honest, I’m doing this with a friend of mine, and he was the one who discovered this bug, for some reason, this bug never happened to me, it only happens to my friend, which is really weird.
You can see the video below:
https://gyazo.com/34b16345bc9681bcebe8c6826adce43c
Local Script:
script.Parent.Activated:Connect(function()
if (Player.Character.HumanoidRootPart.Position-Mouse.Hit.p).magnitude <= Range then
if Mouse.Target.Size then
if Mouse.Target.Size == Vector3.new(3,3,3) then
if Mouse.Target:IsA("Part") and Mouse.Target.Name ~= "baseblock" and Mouse.Target.Name ~= "handle" then -- if the block has one of these names then it won't break
RemoteEvent:FireServer(Mouse.Target,Clicks,VFX,Life,BreakSound)
end
end
end
end
end)
Module Script:
function module.BreakBlock(Player, Target, Clicks,VFX,Life,SoundBreak)
local Sound = SoundBreak:Clone()
local NewClicks = Life.Life.Size.X.Scale / Clicks
local NewLife = nil
local NewVFX = VFX:Clone()
NewVFX.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,Target.Color),ColorSequenceKeypoint.new(1,Target.Color)}
NewVFX.Parent = Target
NewVFX:Emit(4)
if not Target:FindFirstChild("Durability") then
local Durability = Instance.new("IntValue")
local NewLife = Life:Clone()
Durability.Value = Clicks - 1
Durability.Name = "Durability"
Durability.Parent = Target
NewLife.Parent = Target
NewLife.Enabled = true
NewLife.Life.Size = NewLife.Life.Size - UDim2.new(NewClicks,0,0,0)
else
if Target.Durability.Value > 1 then
local NewLife = Target.Life
Target.Durability.Value = Target.Durability.Value - 1
NewLife.Life.Size = NewLife.Life.Size - UDim2.new(NewClicks,0,0,0)
elseif Target.Durability.Value == 1 then
Target:Destroy()
end
end
delay(1,function()
NewVFX:Destroy()
end)
end
Can someone help me plsssssss???