I’m making a script that cycles through various decals on each click, and saves it into a StringValue (named SValue.) When I click, it doesn’t add to the StringValue; it leaves it blank. Anyone know what I’m doing wrong?
local ImageButton = script.Parent
local NomButtonGui = ImageButton.Parent
local SValue = NomButtonGui.Screen1Value
value = 1
ImageButton.MouseButton1Up:Connect(function()
if (value < 5) then
value = (value + 1)
else value = 1
end
if value == 1 then
SValue.Value = ("http://www.roblox.com/asset/?id=4821413675")
elseif value == 2 then
SValue.Value = ("http://www.roblox.com/asset/?id=4821413941")
elseif value == 3 then
SValue.Value = ("http://www.roblox.com/asset/?id=4821414237")
elseif value == 4 then
SValue.Value = ("http://www.roblox.com/asset/?id=4821414523")
elseif value == 5 then
SValue.Value = ("http://www.roblox.com/asset/?id=4821414820")
end
end)
local ImageButton = script.Parent
local NomButtonGui = ImageButton.Parent
local SValue = NomButtonGui.Screen1Value
value = 1
ImageButton.MouseButton1Click:Connect(function()
if (value < 5) then
value = (value + 1)
else value = 1
end
if value == 1 then
SValue.Value = "http://www.roblox.com/asset/?id=4821413675"
elseif value == 2 then
SValue.Value = "http://www.roblox.com/asset/?id=4821413941"
elseif value == 3 then
SValue.Value = "http://www.roblox.com/asset/?id=4821414237"
elseif value == 4 then
SValue.Value = "http://www.roblox.com/asset/?id=4821414523"
elseif value == 5 then
SValue.Value = "http://www.roblox.com/asset/?id=4821414820"
end
end)
My objects are laid out like this:
You need to also make sure when you are checking to see if the string value is changing to check the PlayerGui and not the StarterGui