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

How do i change a StringValue Via a script?

Asked by 6 years ago

I want to make a simple advertising system, but my problem is that i cant figure out how to change a StringValue's value on a script, I made a gui with a textbutton and a textbox and people will enter the decal id they want to advertise in the textbox and when they click the textbutton the script will add a comma and a space and then the decal id, i am new to scripting, Thank you, Here is my script (for the textbutton)

1bought = true
2local stringvalue = game.Workspace.VurionaLoader.IDSHERE.Value
3local decal = script.Parent.Parent.TextBox.Text
4 
5script.Parent.MouseButton1Click:connect(function()
6    if bought == true then
7        --I dont know what to do here
8    end
9end)

2 answers

Log in to vote
1
Answered by 6 years ago

Simply assign the value.

1local bought = false
2local stringvalue = game.Workspace.VurionaLoader.IDSHERE -- Don’t add the .Value
3local decal = script.Parent.Parent.TextBox -- Don’t add the .Text
4 
5script.Parent.MouseButton1Click:Connect(function()
6    stringvalue.Value = "This is my value"
7end)

That’s how you assign values to a StringValue.

0
I dont want to remove the data that is already there User#22889 0 — 6y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 3 years ago

If you do not want to delete the current value, you can join the two values

1local bought = false
2local stringvalue = game.Workspace.VurionaLoader.IDSHERE -- Don’t add the .Value
3local decal = script.Parent.Parent.TextBox -- Don’t add the .Text
4 
5script.Parent.MouseButton1Click:Connect(function()
6    stringvalue.Value = decal.Text..IDSHERE.Value
7end)

Hope this is what your looking for!

Answer this question