hello! I’m trying to make a killbrick that is toggleable using collectionservice, however when I remove the tag via a bindable function, the killbrick will still kill the player on contact. selecting the killbrick while the game is active shows that the tag isn’t on the killbrick, yet it still kills me.
Here’s the loop.
for i, killbrick in pairs(CollectionService:GetTagged("Killbricks")) do
killbrick.Touched:Connect(function(touch)
local humanoid = touch.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = 0
elseif not killbrick:HasTag("Killbricks") then
return
end
end)
ButtonPromptInteracted.OnInvoke = function()
CollectionService:RemoveTag(switchableKillbrick, "Killbricks")
print("SwitchableKillbrick removed from Killbricks tag")
switchableKillbrick.Color = Color3.new(0.0431373, 1, 0.152941)
end
end
I tried adding some logic that checks if a killbrick doesn’t have the Killbricks tag, but that doesn’t work etiher.
Here’s the script inside my ProximityPrompt that fires the BindableFunction (ButtonPromptInteracted)
local CollectionService = game:GetService("CollectionService")
local button = script.Parent
local buttonPrompt = button.ProximityPrompt
local switchableKillbrick = workspace.Obby.Killbricks.SwitchableKillbrick
local ButtonPromptInteracted = game.ReplicatedStorage.ButtonPromptInteract
buttonPrompt.Triggered:Connect(function()
ButtonPromptInteracted:Invoke()
end)
I’ve also tried simply connecting the Triggered event directly to the logic that removes the switchable killbrick from the Killbricks tag, but I don’t think the problem’s there either.