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

How would I transfer leaderboard IntValues?

Say I have a IntValue in another script because it is an Interger it can transfer through scripts (so I am told), how would I do that, please provide examples if need be! Thanks!

1 answer

✓ Accepted answer

First, it cannot pass data between scripts because it is an integer, but because it is an instance. An instance is basically a 'thing'. For example, a Part is an instance, a Script is an instance, a ScreenGui is an instance. You do not put an instance in the code of a script, but you can access it with the code. For example, let's say you have an IntValue in workspace.

Script1:

game.Workspace.IntValue.Value = 5

Script2:

wait(1)
if game.Workspace.IntValue.Value == 5 then
	print("It's 5")
end

Here, you can see that in one script we changed the int value, and in the other script we checked what value it was. Both scripts need the other in order to complete the task, and they both rely on the existence of an IntValue in workspace.

Another example is a GUI timer. It's very common to put an IntValue in workspace, then 1 script makes the int value count down from a number (100, for example), and the second script makes the GUI's text equal to that of the IntValue's value.

2 comments

0

Thanks alot as a side note, how would you do that last bit, I have a rough idea from previous scripts but thanks!

0

To count down, look into for loops. To detect when the value changes, look into the Changed event. Then attempt some code and ask another question if you need help!

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