I’m making a health bar for a chest in my game and the script inside of the progress bar won’t receive an event fired from a proximity prompt, which fires the event as I put a print statement and it printed.
The issue is within this script, and none of the numbers print (for testing purposes obvi):
local Health = 4
game.ReplicatedStorage.QuestEvents.ShovelDig.OnClientEvent:Connect(function()
print(1)
Health -= 1
print(2)
script.Parent:TweenSize(UDim2.new((Health/4), 0, 1, 0), "Out", "Quint", 0.3, true)
print(3)
script.Parent.Parent.Parent.ProgressText.Text = "Damage | "..Health.."/4"
print(4)
if Health == 4 then
script.Parent.BackgroundColor3 = Color3.fromRGB(41, 206, 74)
elseif Health == 3 then
script.Parent.BackgroundColor3 = Color3.fromRGB(255, 241, 38)
elseif Health == 2 then
script.Parent.BackgroundColor3 = Color3.fromRGB(255, 184, 3)
elseif Health == 1 then
script.Parent.BackgroundColor3 = Color3.fromRGB(255, 46, 46)
elseif Health == 0 then
game.ReplicatedStorage.QuestEvents.DugUpTreasure:FireServer()
script.Parent.Parent.Parent.Parent:Destroy()
end
end)