Im trying to get a child, and it worked in one game, but not this one i just moved it to… Please help
local TweenService = game:GetService("TweenService")
local Script = script
local Players = game:GetService("Players")
local Character = Script.Parent
local Player = Players:GetPlayerFromCharacter(Character)
local Run = game:GetService("RunService")
local bar = Character.Head:WaitForChild("OverheadGUI"):WaitForChild("HealthBar"):WaitForChild("Bar") --It cant find this, even though after many checks, its there.
local event = game.ReplicatedStorage.LowHealth
local info = TweenInfo.new(
1,
Enum.EasingStyle.Cubic
)
Player.Character.Humanoid.HealthChanged:Connect(function()
local bar = Character.Head:WaitForChild("OverheadGUI"):WaitForChild("HealthBar"):WaitForChild("Bar")
event:FireClient(Player, Player.Character.Humanoid.Health)
local barheath = Player.Character.Humanoid.Health * 2
print(barheath)
--bar.Size = UDim2.new(0, barheath, 0, 16)
TweenService:Create(bar, info, {Size = UDim2.new(0, barheath, 0, 16)}):Play()
bar.ImageColor3 = Color3.new(1, 0, 0):Lerp(Color3.new(0, 1, 0), Player.Character.Humanoid.Health / 100)
end)
It is located is starter character scripts
even after checking for correct spelling, it still wont work. i have changed nothing from when it was in the previous game…