What do you want to achieve? I want the script to update the gui with the latest value of magic
What is the issue? not sure how to use .changed()
What solutions have you tried so far? I did look on the devHub but it’s not very useful-
if you have any questions, let me know
local player = game.Players.LocalPlayer
local character = player.Character
local witch = character:WaitForChild("Witch")
local magic = character:WaitForChild("Magic")
local magicCapacity = character:WaitForChild("MagicCapacity")
local main = script.Parent.Frame.Main
local MagicGui = script.Parent
local Text = script.Parent.Frame.TextLabel
local percent = magic.Value / magicCapacity.Value
if witch.Value == true then
MagicGui.Enabled = true
Text.Text = magic.Value.."/"..magicCapacity.Value
main.Size = UDim2.new(percent,0,1,0)
end
should I use .Changed or some other function to get the latest value?
The text shows up as Label, I’ve tried to use the other script above but it still shows up as Label. What else can I try since I’ve tried putting it under witch.Value yet it still didn’t work
If OP is using a ValueBase object then it’s not necessary to use GetPropertyChangedSignal. ValueBase objects have a specialised version of Changed that fires when the value changes and the new value is passed as an argument to connected functions. GetPropertyChangedSignal and Changed on a ValueBase should be functionally equivalent, but it is better to use Changed because you can access the new value as a passed value.