Helped Needed | Script Not Reading Value In Player Correctly

Hi there so here is my issue:
I am currently working on a few scripts which work together to do one main thing. Anyway, so I am running through all children of the player when they leave in the script below however when they read the value of the int and str values they are reading a value which was old and I have changed in the taskbar at the bottom in roblox studio. I do not know why it is doing this and why its not reading the updated value. If anyone could help it would be greatly appreciated.

for i, v in pairs(Player:GetChildren()) do
		
		if v:IsA("IntValue") or v:IsA("StringValue") then
			print(v.Name)
			print(v.Value)
			inv[v.Name] = v.Value
		end
	end 
1 Like

I assume by “taskbar” you mean the command line at the bottom.

I’m almost 100% sure that is a local thing and not server thing. So any changes will only be made in the client, unless you fire a remoteEvent/Function. So you have to fire a remoteEvent to update it serverSide

1 Like

You don’t have to use the task bar. Press F5, go to ServerSide and then whatever you edit will affect the game just like a script. For instance, if you move the head of the player’s character with your cursor it will kill the player because the neck joint is seperated. Same for values, just find them in the explorer and turn them on or off

1 Like

Ah okay. Thanks. I will try that now to see if I can get it working.

1 Like

How exactly might I go about doing this?

Well, if you’re doing this on server, then I would assume that it shouldn’t be reading the old values, since you’re calling it when the players are removed, meaning there wouldn’t be much chance of changing it.

You can use GetPropertyChangedSignal, if you’re confident it’s going to be updated sometime, including through the explorer, command bar, etc.

for i,v in pairs(Player:GetChildren()) do
	if v:IsA("IntValue") then
		print(v.Name)
		v:GetPropertyChangedSignal("Value"):Connect(function()
           	inv[v.Name] = v.Value
			print(v.Value)
		end)
	end
end

Alright strange though. I have entered the actual game and opened the manager (F9) and it works perfectly fine there. Guess its okay just not working inside of studio for some reason. And yes my api datastore access is enabled.