Need help with tweening

Hello! I am making a Survival Game and I don’t know why this doesn’t work. Can somebody help me?

-- Services
local replicatedStorage = game:GetService("ReplicatedStorage")
local serverStorage = game:GetService("ServerStorage")

local plr = game.Players.LocalPlayer

repeat wait()
until plr.Character

local Character = plr.Character

local maxHunger = 100
local maxThirst = 100
local maxSanity = 100

--Values

local Stat = plr:WaitForChild("Stats")

local Hunger = Stat:WaitForChild("Hunger")

local Sanity = Stat:WaitForChild("Sanity")

local Thirst = Stat:WaitForChild("Thirst")

--Guis

local MainGui = game.StarterGui:WaitForChild("Hud")

local ThirstGui = MainGui:WaitForChild("Thirst")
local HungerGui = MainGui:WaitForChild("Hunger")
local SanityGui = MainGui:WaitForChild("Thirst")

Hunger:GetPropertyChangedSignal("Value"):Connect(function()
	print("yes")
	local Change = Hunger.Value / (maxHunger)
	print(Change)
	HungerGui.ImageLabel.Bar:TweenSize(UDim2.new(Change, 0, 1, 0 ))
end)

You’re using the StarterGui instead of the PlayerGui. The reason why you must use PlayerGui is because everything IN the StarterGui clones into the PlayerGui, so the player doesn’t see what’s inside of the StarterGui, they see what’s inside of the PlayerGui.

Replace that line with:

local MainGui = plr:WaitForChild("PlayerGui"):WaitForChild("Hud")
4 Likes

Thanks! :slight_smile: :slight_smile: