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

Changing an int value in Replicated Storage not working (?)

local wave = game.ReplicatedStorage.Wave.Value
wave = wave + 1

For some reason this isn't working, it stays at 0 when the game is launched.

Any help is much appreciated.

1 answer

✓ Accepted answer

First you have to be sure you make it a serverscript

But the actual problem is the game.ReplicatedStorage.Wave.Value will result in something like this for the script

local wave = game.ReplicatedStorage.Wave.Value
-- For the server: local wave = 0
wave = wave + 1
-- For the server: local wave = wave + 1 --> 1

But it won't change the value, to do this you have to have the variable as an object and change the objects value like this

local wave = game.ReplicatedStorage.Wave
wave.Value = wave.Value + 1

Hope this helped, if you have any more questions, just ask :)

2 comments

0

Thank you :)

0

Np :)

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