Stringvalue inside Playergui not being found by script

Hi, so I’m trying to make a settings GUI for a game which saves what settings you set it to. The way I am saving the value is by sending the final value (which looks like something like “4441431”) via an Remote event so a serverside script can then set the string value for the player and then update the value in the datastore once the GUI is closed. Here comes the problem. It is able to change the value successfully, but is not able to apply the value to the string value inside the player GUI, leaving it stuck on the value it was before. There is no error in the console during runtime, however if I attempt to change the value using the console it simply returns “Settingvalue is not a valid member of ScreenGui”, while it does clearly exist.

Path to the value:
image_2022-05-03_192831351

The way I am getting the value (note that player is supplied through the remote event):

local settingvalue = player.PlayerGui:WaitForChild("Settings"):WaitForChild("SettingValue").Value

The way I am attempting to set the value (new_val being the new updated string value it’s supposed to set):

settingvalue = new_val

Is this an issue on my end or can scripts for some reason not do this?

2 Likes

You are setting the variable to be the actual value Instead of the instance. When you try to change the instance’s value, you are only changing the variable.
Try

local settingvalue = player.PlayerGui:WaitForChild("Settings"):WaitForChild("SettingValue")
settingvalue.Value = new_val
2 Likes

Ah, I see. I’ll note that down for future reference. Tysm!