Hello!
I’m making a football game to have matches with friends, and am making those ‘LED borders’ around the edges of the pitch.
I’m using Adonis Admin and am making a custom command on it to be able to change what’s on the boards.
This is the command code:
settings.Commands = {
boards = { --// The index & table of the command
Prefix = Settings.Prefix; --// The prefix the command will use, this is the ':' in ':ff me'
Commands = {"boards", "board", "setboard"}; --// A table containing the command strings (the things you chat in-game to run the command, the 'ff' in ':ff me')
Args = {"decal/texture/clear", "id (unless type is CLEAR)"}; --// Command arguments, these will be available in order as args[1], args[2], args[3], etc; This is the 'me' in ':ff me'
-- args[1] = decal/texture/clear
-- args[2] = id
Description = "Change the LED boarders' content";--// The description of the command
AdminLevel = 200; -- Permission level
Filter = false; --// Should user supplied text passed to this command be filtered automatically? Use this if you plan to display a user-defined message to other players
Hidden = false; --// Should this command be hidden from the command list?
Function = function(plr, args, data) --// The command's function; This is the actual code of the command which runs when you run the command
--// "plr" is the player running the command
--// "args" is a table containing command arguments supplied by the user
--// "data" is a table containing information related to the command and the player running it, such as data.PlayerData.Level (the player's admin level)
if not args[1] then
error("You need to supply a type (decal or texture or clear)!")
elseif (not args[2]) and (args[1] ~= "clear") then
error("You need to supply an ID!")
elseif (not tonumber(args[2])) and (args[1] ~= "clear") then
error("The ID must be a number!")
else
if string.lower(args[1]) == "decal" then
for i,v in pairs(game.Workspace.LEDBorders:GetChildren()) do
v.Main.Blank.Transparency = 1
v.Main.SetTexture.Transparency = 1
v.Main.Video.SetVideo.Video = ""
v.Main.SetDecal.Transparency = 0
v.Main.SetDecal.Texture = "http://www.roblox.com/asset/?id=" .. args[2]
end
elseif string.lower(args[1]) == "texture" then
for i,v in pairs(game.Workspace.LEDBorders:GetChildren()) do
v.Main.Blank.Transparency = 1
v.Main.SetDecal.Transparency = 1
v.Main.Video.SetVideo.Video = ""
v.Main.SetTexture.Transparency = 0
v.Main.SetTexture.Texture = "http://www.roblox.com/asset/?id=" .. args[2]
end
elseif string.lower(args[1]) == "clear" then
for i,v in pairs(game.Workspace.LEDBorders:GetChildren()) do
v.Main.Blank.Transparency = 0
v.Main.SetDecal.Transparency = 1
v.Main.SetTexture.Transparency = 1
v.Main.Video.SetVideo.Video = ""
end
else
error("Invalid type. Type must be decal/texture/clear")
end
end
end
};
}
The command itself works fine: it runs and changes the transparencies and sets the texture in either the Texture or Decal. But the image doesn’t show: it just goes blank. (Note that CLEAR works fine as the texture property of Blank doesn’t change!)
This is an example of what happens, in which you can see the properties changing as they should but the board remains blank. And then when I manually input the ID, it works fine. https://gyazo.com/528d7151ee9183f07a80692272daa52f
I’ve tried both "rbxasset://" .. args[2]
and also "http://www.roblox.com/asset/?id=" .. args[2]
but neither work.
Any help would be much appreciated! Stay safe!!