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

Why is my string value not changing?

Hi. I have a localscript which is inside a Gui. When you select one of two buttons on the ScreenGui, it should update the value of a StringValue in ReplicatedStorage.

This is my script:

local Bristol = script.Parent
local MintCreek = script.Parent.Parent.MintCreek
local Data = game.ReplicatedStorage.CheckInBoards.Lane1.Destination.Value

script.Parent.MouseButton1Click:Connect(function()
	-- Select Bristol
	Bristol.BackgroundColor3 = Color3.fromRGB(12, 76, 153)
	Bristol.AutoButtonColor = false
	Bristol.Selectable = false
	Data = "BristolDest"
	
	-- Change MintCreek
	MintCreek.AutoButtonColor = false
	MintCreek.Selectable = false
	MintCreek.LocalScript:Destroy()
end)`

Any help would be greatly appriciated.

Thanks in advance, Timothy

1 answer

✓ Accepted answer

For future reference i suggest you create a variable to fetch that value. WITHOUT setting the ".Value" in the variable as this will cause you to preset the variable to whatever the first value was without any way to change it.

local Data = game.ReplicatedStorage.CheckInBoards.Lane1.Destination

to change this value simply do Data.Value = "BristolDest"

if you have more question just ask ~Hakurem

1 comment

0

Thanks.

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