"invalid argument #1 to 'pairs' (table expected, got string)"

I don’t know how to explain what I’m doing, but I hope this explains it. How would I fix this?

local Wave1 = {
	"2 Enemy"

}

for i,v in pairs("Wave"..game:GetService("ReplicatedStorage").Wave.Value) do

The code sample does not explain much, what are you trying to for loop iterate over? Also your Wave1 variable is unused.

Are you trying to iterate over children of something?

for i, v in ipairs(game:GetService("ReplicatedStorage"):GetChildren()) do
1 Like
local Waves = {
	[1] = { -- change 1 to "1" if your Wave is a StringValue btw
		-- wave 1
		"2 Enemy"
	},
}

for i, v in Waves[game:GetService("ReplicatedStorage").Wave.Value] do
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.