Proximity Prompt script doesn't function

So what I am trying to achieve is a proximity prompt that plays a sound and makes it seem as if the handle was pulled instead of actually tweening the handle. But for some reason, it keeps displaying this error message in the output:

local prompt = script.Parent
local SwitchHandle = prompt.Parent
local SwitchHandle2 = script.Parent.Parent.Parent.SwitchHandle2
local Sound1 = script.Parent.Sound1
local Sound2 = script.Parent.Sound2


prompt.Triggered:Connect(function()
	script.Parent.Sound1:Play()
	wait(6.5)
	script.Parent.Sound2:Play()
	SwitchHandle.Transparency = 1
	SwitchHandle.CanCollide = false
	prompt.Enabled = false
	
	SwitchHandle2.Transparency = 0
	SwitchHandle2.CanCollide = true
			end
		end
	end
end)

This is very obvious to know why it’s not working. By checking your output, you gave 3 ends instead of giving a right bracket or instead of closing it. Why did you add 3 ends anyway lol?

Fixed script if you don’t know what I meant

local prompt = script.Parent
local SwitchHandle = prompt.Parent
local SwitchHandle2 = script.Parent.Parent.Parent.SwitchHandle2
local Sound1 = script.Parent.Sound1
local Sound2 = script.Parent.Sound2


prompt.Triggered:Connect(function()
	script.Parent.Sound1:Play()
	wait(6.5)
	script.Parent.Sound2:Play()
	SwitchHandle.Transparency = 1
	SwitchHandle.CanCollide = false
	prompt.Enabled = false
	
	SwitchHandle2.Transparency = 0
	SwitchHandle2.CanCollide = true
end)
1 Like

I always sucked with ends and thought I had to put ends until the error goes away or something :laughing:

1 Like

That’s funny, but its easy to spot when you see the red underline that shows that there’s a problem with it so there’s no way you would suck when using ends. :slight_smile:

1 Like