So this is what my script is.
I keep getting this error that says Players.Player.PlayerGui.Menu.Frame.Hats.LocalScript:18: bad argument #1 to 'random' (interval is empty)
local hats = { Spikey = {Name="Spikey",Location=game:GetService("ReplicatedStorage"):WaitForChild("Ultra-Fabulous Hair")}; Cowlick = {Name="Front Cowlick",Location=game:GetService("ReplicatedStorage"):WaitForChild("FrontCowlick")}; } local Dummy = workspace:WaitForChild("Dummy"); local Parent = script.Parent; local Last = Parent:WaitForChild("Last"); local Next = Parent:WaitForChild("Next"); local HatName = Parent:WaitForChild("HatName"); Next.MouseButton1Click:connect(function() for i,v in pairs(Dummy:GetChildren()) do if v:IsA("Hat") then v:remove() end end local newhat = math.random(#hats); local newhatc = hats[newhat]; newhatc.Location:Clone().Parent = Dummy; HatName.Text = newhatc.Name end)
I'm not completely positive, but the error's solution may be, that you need to join line 18 and 19.
local newhat = hats[math.random(#hats)]
I assume since you already define 'newhat', it already tried to get a random value. But of course, since '#hats' isn't a proper interval (a range of numbers), it errored.