Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why Does This Happen?

Asked by
wackem 50
9 years ago
  1. I've disabled the CoreGui backpack using "game.StarterGui:SetCoreGuiEnabled("Backpack",false)" and it disabled all of them, why?

  2. I am re-creating the healthbar to fix this with this script for a frame, I can't figure out why it doesn't work, no errors come out in the output.

script for healthbar replacement:

local plr = script.Parent.Parent.Parent.Parent local char = plr:WaitForChild("Character")

local hum = char:FindFirstChild("Humanoid")

function sweg() if hum then local frm = script.Parent frm.Size = UDim2.new(0, 25, 0, hum.Health) end end

hum.Health.Changed:connect(sweg)

the parent ladder is correct, so I can't think of other issues.

1 answer

Log in to vote
0
Answered by 9 years ago

Q1. Is the script Local? It NEEDS to be, also, the moved the health bar over to the top of the screen, same with the chat thing. If you STILL don't see them, try this code instead:

--LocalScript
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

Q2. I'll tell you all the changes I did:

local plr = script.Parent.Parent.Parent.Parent
local char = plr.Character --Instead of WaitForChild.
local hum = char:WaitForChild("Humanoid") --Changed THIS to wait for child

hum.Changed:connect(function() --Turned this into an Anonymous Function To make it shorter.
    script.Parent.Size = UDim2.new(0,25,0,hum.Health)
end)


Hope this helps!

Ad

Answer this question