I asked this a bunch of times but no one knew what they were saying. I have a string value inside workspace called Data. Here is a very simplified version of the program.

function Example()
	while game.Workspace.Data.Value == 1 do
		print("Going")
		wait(.1)
	end
	print(complete)
end
Example()

I need to keep this in the form of a function. If you give me an answer, please give me a working script and not just a random answer. Thanks!

2 comments

0

If you are trying to increment Data's value, you can do local Data = workspace.Dataand Inside the function, Data.Value = Data.Value + 1. Although, I am not sure what exactly you want to update.

0

you could set the data's value just as you would outside of a function, the only difference is the scope in which you can access your variable (if it is defined local)