Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
0
Answered by
Uglypoe 557 Donator Moderation Voter
8 years ago

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.

Ad

Answer this question