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

How do you use arguments/variables in a location?

Asked by 9 years ago

I am trying to make a plugin but it gives an error that says: "Mat" is not a valid Enum material. I have tried parentheses and quotations, parentheses, and quotations. This is the code

local plugin = PluginManager():CreatePlugin()
local toolbar = plugin:CreateToolbar("Filling tools")
local button = toolbar:CreateButton(
    "", 
    "Flood fill", 
    "Potato.png" 
    )

Fillblock=""
active = 0
--____________________________________________

_G.Changeblock = function(Mat)
    Fillblock = Enum.Material.Mat
end
--____________________________________________

button.Click:connect(function()
    if active == 0 then
    plugin:Activate(true)
    active = 1
    print("Welcome to Warman13579's Fill plugin! Type in _G.help() to see the commands")
    wait(1)
    print("Select your material! The list of current materials is: Slate, Brick, WoodPlanks, Sand, Water, and concrete. Type _G.Changeblock(water) (water in quotations) for example.")
    else
    active = 0
    plugin:Activate(false)
    print("Goodbye")
    end
end)
--_____________________________________________

NOTE: Some functions are not implemented like _G.Help()

0
function x(y) print(Enum.Material[y]) end x('Grass') -->Enum.Material.Grass. ImageLabel 1541 — 9y

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

You have to use the [] operator!

_G.Changeblock = function(Mat)
    Fillblock = Enum.Material[Mat]
end
0
I could of thought of that XD dang it! EzraNehemiah_TF2 3552 — 9y
Ad

Answer this question