So I’m trying to make a local script which tells a gui how many potions the player has remaining, however when the potion is used it doesn’t relay the updated amount of remaining potions.
local Gui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local Backpack = Gui:WaitForChild("Backpack")
local Hotbar = Backpack:WaitForChild("HotBar")
local Potions = Hotbar.Stats:WaitForChild("Potions")
local Equipped = false
script.Parent.Equipped:Connect(function()
Equipped = true
local Name = Potions:WaitForChild("Name")
local Doses = script.Parent.Doses.Value
local Count = Potions:WaitForChild("Count")
Potions.Visible = true
Name.Text = script.Parent.Name
Count.Text = Doses
end)
script.Parent.Activated:Connect(function()
print ("running") -- THIS DOESN'T PRINT
local Doses = script.Parent.Doses.Value
local Count = Potions:WaitForChild("Count")
Count.Text = Doses
end)
script.Parent.Unequipped:Connect(function()
Equipped = false
Potions.Visible = false
end)