local uis = game:GetService("UserInputService") local plr = game:GetService("Players").LocalPlayer local Materials = Enum.Material:GetEnumItems() -- Get a table of all the possible materials local RandomMaterial = Materials[math.random(#Materials)] -- Select a random value inside the table uis.InputBegan:Connect(function(input, gameProcessed) if input.KeyCode == Enum.KeyCode.Y then local part = Instance.new("Part") part.Name = "WEEWOO" part.CFrame = plr.Character.HumanoidRootPart.CFrame - Vector3.new(0, 4, 0) part.Size = part.Size + Vector3.new(3, 3, 3) part.Anchored = true part.Material = RandomMaterial -- Set the random material part.BrickColor = BrickColor.Random() part.Parent = game.Workspace end end)