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

Won't let me change a "UserData" Value?

I have this script that when a button is pressed the value Num, which I created, is supposed to change, but it keeps saying I can't change "UserData" Values.

function Change()
if script.Parent.Parent.Num.Value < 9 then
	script.Parent.Parent.Num.Value = script.Parent.Parent.Num + 1
end
end

script.Parent.MouseButton1Down:connect(Change)

1 answer

✓ Accepted answer
  1. When you changed the value on line 3, you didn't specify the value you were adding "1" to. You just labeled the instance. Add a ".Value" after the .Num on line 3!

  2. Try changing Parent.Num to Parent:FindFirstChild("Num"), sometimes Roblox is finicky and believes that is a property of the parent instance.

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