GUI.Button1.MouseButton1Click:connect(function() a = z + 1 script.statusv1.Changed:connect(function() statusv1.Value = a end) end)
I'm trying to change a string value with a variable but the value is not changing.
statusv1 is the string value.
First off, the Changed
event is only fired when the targeted instance is changed. There is no need to make an event to wait for that if you only mean to set it.
Second off, you need to know what a StringValue is. A StringValue holds a string, like "Hello!". What you seem to be looking for is an IntValue, which holds integers. If you are looking at saving real numbers try out NumberValues for size.
In other words, to fix your problem: 1. Change script.statusv1 to an IntValue 2. Replace the code block you have provided us with with the one bellow:
GUI.Button1.MouseButton1Click:connect(function() local a = z + 1 -- Making a local keeps it within the scope. I am also assuming that you already have z defined script.statusv1.Value = a