The output displays an error when i try to detect if a number value has changed, how do i fix that?
This question has been solved by the original poster.
This is the script:
01 | local plr = game.Players.LocalPlayer |
02 | local char = plr.CharacterAdded:Wait() |
03 | local hum = char:WaitForChild( "Humanoid" ) |
04 | local magicbar = script.Parent.Parent |
05 | local magic = magicbar.MagicEBar |
06 | local textmagic = magicbar.Amount 2 |
07 | local startergui = game:GetService( "StarterGui" ) |
08 | local magice = plr:WaitForChild( "MagicEnergy" ) |
09 | local maxmagice = plr:WaitForChild( "MaxMagicEnergy" ) |
11 | local function update() |
12 | magic:TweenSize(UDim 2. new( 0 , magice.Value / maxmagice.Value * 395 , . 38 , 0 ), "Out" , "Quad" , 0.1 , true ) |
14 | textmagic.Text = math.floor(magice.Value).. "/" ..math.floor(maxmagice.Value) |
17 | magice.Value.Changed:Connect(update) |
19 | startergui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false ) |
It's a local script since it's related to the Gui.
The output displays this error:
Players.iiiAmericanLight.PlayerGui.MainGui.HpMagicFrame.Background.MagicEBar.ValueScript:18: attempt to index field 'Value' (a number value)