I can not figure out why this script does not wokrs

It does not gives me any error please help

v = script.Parent.Parent.Value
click = script.Parent.ClickDetector

function wat(player)
	if player.TeamColor == script.Parent.Parent.Parent.Parent.TeamColor.Value then
		if v.Value == true then
			v.Value = false
			script.Parent.BrickColor = BrickColor.new("Really red")
			for i,v in pairs(script.Parent.Parent.Lasers:GetChildren()) do
				v.BrickColor = BrickColor.new("Bright green")
				v.Transparency = .8
			end
				
		elseif v.Value == false then
			v.Value = true
			script.Parent.BrickColor = BrickColor.new("Lime green")
			for i,v in pairs(script.Parent.Parent.Lasers:GetChildren()) do
				v.BrickColor = BrickColor.new("Bright red")
				v.Transparency = .2
			end
			
		end
	end
end

script.Parent.Clicker.ProximityPrompt.Triggered:connect(wat)
2 Likes

What is this supposed to be for?

it checks if it is turned off or on

This one works perfectly with clickdetector but when I replaced with proximity promt it does not work anymore here is code:

v = script.Parent.Parent.Value
click = script.Parent.ClickDetector

function wat(player)
	if player.TeamColor == script.Parent.Parent.Parent.Parent.TeamColor.Value then
		if v.Value == true then
			v.Value = false
			script.Parent.BrickColor = BrickColor.new("Really red")
			for i,v in pairs(script.Parent.Parent.Lasers:GetChildren()) do
				v.BrickColor = BrickColor.new("Bright green")
				v.Transparency = .8
			end
				
		elseif v.Value == false then
			v.Value = true
			script.Parent.BrickColor = BrickColor.new("Lime green")
			for i,v in pairs(script.Parent.Parent.Lasers:GetChildren()) do
				v.BrickColor = BrickColor.new("Bright red")
				v.Transparency = .2
			end
			
		end
	end
end

click.MouseClick:connect(wat)

It doesn’t work, because you’re supposed to connect it to the ProximityPrompt.

It’s connected to the mouseclick, if you want it to connect to the prompt:

-- Replace this:
click.MouseClick:connect(wat)

-- With This:
[ProximityPrompt].Triggered:Connect(wat)

Replace the [PriximityPrompt] with wherever the prompt is, which I’m assuming it’s a parent to the script.

1 Like