You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to fix the bargui to make it work after the respawn
What is the issue? Include screenshots / videos if possible!
So whenever i rest only the healthbar gui it does reset
and the bargui(blue gui) it doesnt reset when i respawn
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
So far i tried to ask AI assistant from the roblox one and it gave me no solution
local char = plr.Character or plr.CharacterAdded:Wait()
local curArmour = char:FindFirstChild('Armour')
local maxArmour = char:FindFirstChild('MaxArmour')
local OArmour = char:FindFirstChild('OArmour')
local OMaxArmour = char:FindFirstChild('OMaxArmour')
repeat wait()
curArmour = char:FindFirstChild('Armour')
maxArmour = char:FindFirstChild('MaxArmour')
script.Parent.MainFrame.Visible = false
OMaxArmour = char:FindFirstChild('OMaxArmour')
OArmour = char:FindFirstChild('OArmour')
until (curArmour and maxArmour) or (OArmour and OMaxArmour)
if curArmour and maxArmour and not (OArmour and OMaxArmour) then
script.Parent.MainFrame.Visible = true
script.Parent.MainFrame.Holder.Bar.Size = UDim2.new((curArmour.Value/maxArmour.Value) * 1.013, 0,0.663, 0)
script.Parent.MainFrame.Holder.PercentageDisplay.Text = math.floor(curArmour.Value*10) / 10 .. "/" .. maxArmour.Value
curArmour.Changed:Connect(function()
script.Parent.MainFrame.Holder.Bar.Size = UDim2.new((curArmour.Value/maxArmour.Value) * 1.013, 0,0.663, 0)
script.Parent.MainFrame.Holder.PercentageDisplay.Text = math.floor(curArmour.Value*10) / 10 .. "/" .. maxArmour.Value
end)
end
if OArmour and OMaxArmour then
if OMaxArmour == 0 then
script.Parent.MainFrame.Visible = false
return
end
script.Parent.MainFrame.Visible = true
script.Parent.MainFrame.Holder.Bar.Size = UDim2.new((OArmour.Value/OMaxArmour.Value) * 1.013, 0,0.663, 0)
script.Parent.MainFrame.Holder.PercentageDisplay.Text = math.floor(OArmour.Value*10) / 10 .. "/" .. OMaxArmour.Value
OArmour.Changed:Connect(function()
script.Parent.MainFrame.Holder.Bar.Size = UDim2.new((OArmour.Value/OMaxArmour.Value) * 1.013, 0,0.663, 0)
script.Parent.MainFrame.Holder.PercentageDisplay.Text = math.floor(OArmour.Value*10) / 10 .. "/" .. OMaxArmour.Value
end)
en
The script work fine its for the gun system to shoot an player with the numbers of armor they have
the only issue is that when i respawn the bar gui it doesnt reset like healthbar gui