Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you use arguments/variables in a location?

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()

1 comment

0

function x(y) print(Enum.Material[y]) end x('Grass') -->Enum.Material.Grass.

1 answer

✓ Accepted answer

You have to use the [] operator!

_G.Changeblock = function(Mat)
	Fillblock = Enum.Material[Mat]
end

1 comment

0

I could of thought of that XD dang it!

This discussion is preserved as it was. New answers, comments, and votes are closed.