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

Select system help?

Asked by 8 years ago

I don't know why this script not working automatically... Can help someone? I have 2 scripts.. First script: Selecting (example item) button

local select = script.Parent.Parent.Parent.Selected -- StringValue

function Select()
    select.Value = "Item1"
end

script.Parent.MouseButton1Down:connect(Select)

Second script: Detect selected item and config for buy button and something... (localscript)

local select = script.Parent.Selected
local Image = script.Parent.ImageLabel
local Des = script.Parent.Text
script.Parent.Selected.Changed(function(select)
    if select == "Item1" then
    Image.Image = "http://www.roblox.com/asset/?id=285779644"
    Des.Text = "Bla"
    elseif select == "Item2" then
    Image.Image = "http://www.roblox.com/asset/?id=285779644"
    Des.Text = "Bla"
end)

0
I would always recommend not using Lua keywords as variables like table, spawn, or select as it might cause complications in the script in the future. M39a9am3R 3210 — 8y
0
Oh, thx for that! :D ProCoolEXE 27 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Well, in script 1, your calling on select.Value right?

So wouldn't script 2 be the same way: if select.Value == 1 then

local select = script.Parent.Selected
local Image = script.Parent.ImageLabel
local Des = script.Parent.Text
script.Parent.Selected.Changed(function(select)
    if select.Value == "Item1" then
    Image.Image = "http://www.roblox.com/asset/?id=285779644"
    Des.Text = "Bla"
    elseif select.Value == "Item2" then
    Image.Image = "http://www.roblox.com/asset/?id=285779644"
    Des.Text = "Bla"
end)


0
its stringvalue .-. ProCoolEXE 27 — 8y
0
That doesn't matter. For any Value, you have to call on .Value (i.e VALUENAME.Value) User#9949 0 — 8y
Ad

Answer this question