Problem In My Code In Regional Sound script

hey there devs i am working On A Game.so While developing My Game I Wanted To Add A Region With Certain Sound But I Think There Is Some Problem With My .Actually I New To Scripting And I Wrote The Code Using @Alvin_Blox 's Youtube Video But Since I Am New To Lua Scripting I dont Know How To Identify and Substitute The Variables on my own .
So I Copied word to word whatever was written by @Alvin_Blox in his video.

my code:


local Found = false

while wait(1) do
	
	for i, v in pairs(SoundRegionsWorkspace:GetChildren()) do
		
		Found = false
		local region = Region3.new(v.Position - (v.Size/2),v.Position + (v.Size/2))
		
		local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())
		
		
		for _,part in pairs(parts) do
			--Loop one by one through the parts table
			if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
				--print("Player Was found")
				Found = true
				break
			else
				Found = false
				--print("Player was not found in region")
			end
		end
		
		if Found == true then
			--Start playing some music
			if script.Parent,SoundRegions[v.Name].IsPlaying ==false then
				script.Parent.SoundRegions[v.Name]:Play()
				break
			end
		else
			script.Parent.SoundRegions[v.Name]:Stop()
		end
		
	end
end

The Video I Watched :

my explorer Window Screenshots


should be

if script.Parent.SoundRegions[v.Name].IsPlaying ==false then

instead of a dot (.) you used comma(,)

1 Like

hey friend @Denz_Noviembre That Worked .Thanks Man. :star_struck: