I need help with my function. It is spawning normal bricks every time and I can’t seem to solve the issue. How could I fix the code?
local RNG = math.random(1,4)
function PartSpawner (PartName)
local PartName = Instance.new("Part")
PartName.Parent = workspace
PartName.Shape = Enum.PartType.PartName
end
if RNG == 1 then
PartSpawner(Block)
elseif RNG == 2 then
PartSpawner(Wedge)
elseif RNG == 3 then
PartSpawner(Ball)
elseif RNG == 4 then
PartSpawner(Cylinder)
end
Switch the names. Try to not make different variables the same name
Anyway here:
function PartSpawner (PartType)
local PartName = Instance.new("Part")
PartName.Parent = workspace
PartName.Shape = Enum.PartType[PartType]
end
PartSpawner("Ball") --You have to use a string