Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my string value not changing?

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by
Hakurem 30
5 years ago
Edited 5 years ago

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

0
Thanks. TimothyE33 4 — 5y
Ad

Answer this question