ORdenDev
(orden)
June 27, 2020, 12:08pm
#1
Hello , my idea is to make TV that will show other decals when player click red putton . But my studio shows me this error
and here is a script wich I use in button
local decals = { 161023603,474498948,2837630409,2389399394,3412119510,4737538383}
local TVMonitor = game.Workspace.TVMonitor
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function()
TVMonitor.Decal.Texture = math.random(1,#decals)
end)
Thank you for reading !
Blockzez
(Blockzez)
June 27, 2020, 12:12pm
#2
You settings the Texture
to the id from 1 to the length of the decal.
Index these in arrays:
TVMonitor.Decal.Texture = decals[math.random(1,#decals)];
1 Like
desinied
(desinied)
June 27, 2020, 12:12pm
#3
You should use “rbxasseId://” before your assetId so it’s better for loading, if doing this doesnt work then preload your decals with the ContentProvied and PreloadAsync .
Forgot to index the table, oops
TVMonitor.Decal.Texture = "rbxassetId://" .. decals[math.random(1,#decals)]
1 Like
ORdenDev
(orden)
June 27, 2020, 12:22pm
#4
Maybe there is a mistake ?
button.ClickDetector.MouseClick:Connect(function()
TVMonitor.Decal.Texture = "http://www.roblox.com/asset/?id=" .. decals[math.random(1,#decals)]
end)
It doesn’t want to work still . I also tried rbxassetId://
like you said
desinied
(desinied)
June 27, 2020, 12:25pm
#5
Maybe try using PreloadAsync from the ContentProvider, this will make whatever is inside the given table will be a priority of the que. Hyperlinks for both are in my earlier reply