Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

attempt to index field 'Value' (a number value)?

local Frame = script.Parent.Parent.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("Frame"):WaitForChild("TextBox")
local bacon = script.Parent.Parent:WaitForChild("Folder"):WaitForChild("Timer")
wait(1)
if bacon.Value.Changed then
	print("we got here")

22:54:00.414 - Players.Kitorari.PlayerScripts.LocalScript:4: attempt to index field 'Value' (a number value

How do I fix this?

4 comments

0

Properties cannot have properties. Value is a property, and it returns a number. I'm not sure what you want to do here?

0

When the value changes I nned something specifc to happen.

0

If that's what you want, then connect an event for it.

1

Try to put if bacon.Value.Changed:connect then

1 answer

✓ Accepted answer

Use the Changed Event

For this to work, I'm going to assume you defined everything properly. The ChangedEvent must be called on a Instance. It does not work with properties. Check out this wiki for more info.

local Frame = script.Parent.Parent.PlayerGui:WaitForChild("ScreenGui"):WaitForChild("Frame"):WaitForChild("TextBox")
local bacon = script.Parent.Parent:WaitForChild("Folder"):WaitForChild("Timer")

bacon.Changed:connect(function(prop)
	print(prop.." Was Changed.")
end)
When bacon changes, it will print what changed.

Good Luck!

If I helped, please don't forget to accept my answer.

1 comment

0

Thank you, And I really need to review events.. gg.

This discussion is preserved as it was. New answers, comments, and votes are closed.