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

GUI Button doesn't update String Value?

Hi! I want to update a string value inside a frame with a button in the same frame, but it doesn't work. Can anyone help me? Script:

script.Parent.MouseButton1Down:Connect(function()
    local MapName = script.Parent.Parent.Name
    print(MapName)--This works. I can see the name in the output
    local selectedMap = script.Parent.Parent.Parent.SelectedMap.Value
    selectedMap = MapName--This doesn't
end)

3 comments

0

I already got the value when I defined selectedMap. Line 5 should update the value that selectedMap is

0

Weird

1

Look up the difference between values and references. also, Filtering Enabled

1 answer

Directly update the stringvalue's value instead of assigning it to a variable. All you're doing is just reassigning the variable A to variable B, which does nothing to the string value.

So, instead, you should do this:

something.Parent.Parent.Value = MapName

Or, you can make a reference to the StringValue so you can have cleaner code, like this.

local X = something.Parent.Parent; X.Value = MapName

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