Hello I get a weird error
while wait (0.1) do
local Use = script.Parent.Parent.Use.Value
script.Parent.Text.Value = Use.."/5"
end
The error is
Players.Oldhalit09.PlayerGui.PlacementGui.TextLabel.Set Use:3: attempt to index string with ‘Value’
I tried 3 values: String Value, Int Value, Number Value
Thanks
Oh thanks I’m not careful at all .
2 Likes
Inpultion
(Nash)
September 3, 2022, 11:23am
#4
Adding to what msix29 said instead of using a while true do
loop using something like this:
script.Parent.Parent.Use:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.Text = script.Parent.Parent.Use.Value .. "/5"
end)
The way this works is that it will run the code block when the value updates instead of every 1/10th of a second, just a performance booster.
Also if what the user above said worked, please mark that post as a solution.
Edit: I would mark theirs, they solved the problem I’m just adding to it.
Forummer
(Forummer)
September 3, 2022, 6:52pm
#6
Better yet, you can use the value’s ‘Changed’ event/signal.
local Parent = script.Parent
local Container = Parent.Parent
local Use = Container.Use
local function OnChanged(Value)
Parent.Text = Value.."/5"
end
Use.Changed:Connect(OnChanged)
1 Like