Alright so, I know this isn't part of your question, but consider it a bonus lol
StarterGui -- Everything within it gets cloned into every player's PlayerGui who joins the game
Therefore 'StarterGui' is basically useless when messing with guis (not including a bit more advanced stuff and stuff that has nothing to do with what you're wanting lol)
PlayerGui -- This is what you're wanting, this is where you'll be able to change things..
Not much of an explanation, but hopefully you get the point...
anyways,
I just made an example model for you
Insert a ScreenGui within the StarterGui -- Name the ScreenGui 'Oxygen'
Insert a frame within the ScreenGui -- Make sure the name of the Frame is 'Frame'
I'd recommending changing the First 0 and the Third 0, which is what I do within this example UDim2.new(0,0,0,0) -- I have this frame the size of UDim2.new(.6,0,.1,0)
Insert a new frame inside of that old Frame -- Name this frame 'Bar'
set 'Bar' Size to UDim2.new(0,0,,0,0) -- It will be changed immediately
local value = 100
local Player = game:GetService('Players').LocalPlayer
local PlayerGui = Player:WaitForChild('PlayerGui')
local OxygenFrame = PlayerGui:WaitForChild('Oxygen').Frame
while value > 0 do
wait(1)
value = value - 1
OxygenFrame.Bar:TweenSize(UDim2.new(value/100,0,1,0),'Out','Quad',.05)
end
Any questions, feel completely free to ask!
5 comments
It's because you're changing the StarterGui frame size, not the PlayerGui frame size :) If someone else doesn't beat me to it, ill post an answer momentarily.
Thanks so much! The wikis out there haven't been super clear about the difference.
You're quite welcome
Wait can you actually post a solution because I'm not entirely sure how to script it differently. Thanks
lol I gotchu