I have a clickdetector part which doesnt fire for some reason when I click it, I dont know why this is happening as it doesn’t output and error and doesn’t output the print() I put in help would be appreciated thank you!,
local debounce = false
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function(player)
if player.Character.StatusEffects.InGroup == true and debounce == false then
for i, d in pairs (game.ReplicatedStorage.Parties:GetDescendants()) do
if d:IsA("StringValue") and d.Value == player.Name then
debounce = true
debounce = false
print("works")
elseif player.Character.StatusEffects.InGroup == false and debounce == false then
debounce = true
local humanoidrootpart = player.Character:FindFirstChild("HumanoidRootPart")
humanoidrootpart.CFrame = workspace.Area.Waterfall.Boss.UndyneArena.PlayerPoint.CFrame
wait(0.1)
debounce = false
print("works")
end
end
end
end)
Have you tried putting the print() outside of all if statements and loops? The problem could be with the conditions not being satisfied rather than the function not firing.
local debounce = false
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function(player)
print("click")
if player.Character.StatusEffects.InGroup == true and debounce == false then
for i, d in pairs (game.ReplicatedStorage.Parties:GetDescendants()) do
if d:IsA("StringValue") and d.Value == player.Name then
debounce = true
task.wait(0.1)
debounce = false
elseif player.Character.StatusEffects.InGroup == false and debounce == false then
debounce = true
player.Character:PivotTo(workspace.Area.Waterfall.Boss.UndyneArena.PlayerPoint.CFrame)
task.wait(0.1)
debounce = false
print("works")
end
end
end
end)
local debounce = false
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function(player)
local continueToBossfight = true
if debounce == false then
for i, d in pairs (game.ReplicatedStorage.Parties:GetDescendants()) do
if d:IsA("StringValue") and d.Value == player.Name then
continueToBossfight = false
end
end
if continueToBossfight then
player.Character:PivotTo(workspace.Area.Waterfall.Boss.UndyneArena.PlayerPoint.CFrame)
end
debounce = true
task.wait(0.1)
debounce = false
end
end)
local debounce = false
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function(player)
local continueToBossfight = true
if debounce == false then
if player.Character.StatusEffects.InGroup == true then
for i, d in pairs (game.ReplicatedStorage.Parties:GetDescendants()) do
if d:IsA("StringValue") and d.Value == player.Name then
continueToBossfight = false
end
end
end
if continueToBossfight and player.Character.StatusEffects.InGroup.Value == false then
player.Character:PivotTo(workspace.Area.Waterfall.Boss.UndyneArena.PlayerPoint.CFrame)
end
debounce = true
task.wait(0.1)
debounce = false
end
end)