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

Can't change integer in ReplicatedStorage, help?

I am attempting to change an integer value in my replicated storage but to no avail.

using the following code:

local Gain = game:GetService("ReplicatedStorage"):WaitForChild(ClientModuleStorage"):WaitForChild(ClientDataStorage_Module").Income_Item["Canoe"].MuscleGain;

Gain.Value = Gain.Value * 1000;

end);

My ClientDataStorage_Module looks like this:

local v1 = {
	BadgeId = {
		Stickman = 2124484013, 
		Beast = 2124484014
	}
};
v1.Income_Item = { {
		Name = "Pencil", 
		MuscleGain = 1, 
		Price = 0, 
		MuscleBounce = 1
	}, {
		Name = "Log", 
		MuscleGain = 370, 
		Price = 75500, 
		MuscleBounce = 1
	}, {
		Name = "Canoe", 
		MuscleGain = 555, 
		Price = 111000, 
		MuscleBounce = 1
	} };

1 comment

0

use a codeblock please

1 answer

I see that you're inquiring via module script, in this case please use the 'require' function. Please replace


local Gain = game:GetService("ReplicatedStorage"):WaitForChild(ClientModuleStorage"):WaitForChild(ClientDataStorage_Module").Income_Item["Canoe"].MuscleGain;

To:


local Gain = require(game:GetService("ReplicatedStorage"):WaitForChild(ClientModuleStorage"):WaitForChild(ClientDataStorage_Module").Income_Item[3].MuscleGain)

Remove the .Value previous to 'Gain', since a table key isn't a value:

Gain = Gain * 1000

Also in ClientDataStorage_Module, if there's none, please add in the bottom of the script:

return v1

In case if you have removed it you have to add it else it won't work.

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