#How i delete a frame with values

32 messages · Page 1 of 1 (latest)

umbral dawn
#
local battery = game.ReplicatedStorage.FlashlightBattery.Value
local frame = game.StarterGui.FlashLightGui.Max100

frame.Transparency = battery < 100 -- if battery under 100 it returns 0 otherwise 1
#

also if you want to edit players gui in-game you might want to do this through a local script

#

and change it directly from the player

#
-- LOCALSCRIPT IN PlayerCharacterScripts

local Player = game.Players.LocalPlayer
local battery = game.ReplicatedStorage.FlashlightBattery.Value
local Frame = Player.StarterGui.ScreenGui.FlashLightGui.Max100

Frame.Transparency = battery < 100
#

you also have to add ScreenGui in StarterGui Folder and move your frames inside of it

#

otherwise it wont appear

#

and this only checks once, if you want to check this everytime the value changed you might want to do this instead

#
-- LOCALSCRIPT IN PlayerCharacterScripts

local Player = game.Players.LocalPlayer
local Battery = game.ReplicatedStorage.FlashlightBattery
local Frame = Player.PlayerGui.FlashLightGui.Max100

Battery.Changed:Connect(function()
  Frame.Transparency = Battery.Value < 100
end)
umbral dawn
#

Oh

#

It's a screengui the flashlight gui

#

You should never rename screenguis

#

Instead you name the frame accordingly

#

Let me update the code accordingly

#

You can remove the screenGui

young warren
#

ok ty

umbral dawn
#

And keep the FlashLightGui

young warren
#

i have this error "StarterGui is not a valid member of Player"

umbral dawn
#

Replace startergui with Playergui

#

In local frame

#

Player.StarterGui -> Player.PlayerGui

#

Can you go to players

#

And click the dropdwon

#

On your name

#

I forgot what it is named

young warren
#

Here ?

umbral dawn
#

Ok it's correct then

#

The script should work

young warren
#

not working

low tartanBOT
#

studio** You are now Level 2! **studio

young warren
#

a dont have errors