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

How to use a value to change a address?

Asked by
truted1 21
6 years ago

To start:

local AddressQ = script.Parent.HatAdress.Value
local Button = script.Parent

Button.Image = "https://www.roblox.com/Thumbs/Asset.ashx?width=110&height=110&assetId=" .. game.Workspace.ObjectImageValues.AddressQ.Value.Value

I want to have a value in the model to change and and that will change the destination. Im not sure how to say this. I have a string-value in the model with a "address" and I want it to change what it will pick depending on the addressQ value. so this is the part.

game.Workspace.ObjectImageValues.{AddressQ}.Value.Value

So the addressQ is a variable and it will change. Can I put it in the "tree" and make the destination change places depending on the value of the variable?

Thanks always :)

0
I don't understand the wording of this question... It is possible to do stringValue1.Value = stringValue2.Value if thats what you mean? Vulkarin 581 — 6y
0
like if i have a model with different blocks. And i want a script to clone one and put it somewhere but use the same line of code and just change a variable that is in the code. So instead of like game.workspace.a.color = 1 and then game.workspace.b.color = 1 i would have game.workspace.(variable) .color = 1 and just change the variable for a or b truted1 21 — 6y

1 answer

Log in to vote
0
Answered by
Vulkarin 581 Moderation Voter
6 years ago
Edited 6 years ago

Now that I understand better your best bet is to use a table

local vars = {"a", "b", "c"}

for _, var in pairs(vars) do
    workspace[var].Color = 1
end
Ad

Answer this question