math.Random returning a boolean?

Whenever I try to pull a random thing from a table, i get:
attempt to call a boolean value
I am not sure why but my math.random is returning as a bool?

example:
wait(math.random(1,5)

unclosed wait there

wait(math.random(1,5))

Whoops sorry, just a typo in the post, I didn’t have a typo in the actual script

1 Like

Can we see your code to find a possible issue

it should return a number im very sure, if you said it was a boolean then theres something not right with your whole code

the script: (its for sound)

local event = script.Parent.SoundEvent
local play = true
local wait = true

--sounds
local sounds = script.Parent --folder w/ all sounds in it
local sound = {
	sounds["049_Effective_01"],
	sounds["049_Harm_02"],
	sounds["049_Sense_Disease_02"],
	sounds["049_Resisting_01"],
	sounds["049 (ring around blahblah)"]
}
local sounddebounce = false

event.Event:Connect(function()
	if wait == false then
		for i,v in pairs(sound) do
			if v.IsPlaying then
				return
			end
		end
		wait = true
		sound[math.random(1, #sound)]:Play()
	else
		wait(math.random(1,5))
		wait = false
	end
end)
1 Like

try not using wait as a variable debounce because the script is trying to read which ‘wait’ you meant

3 Likes

I just realized that, this was such a stupid reason
Thankyou!

1 Like