Touched event firing for everyone

I am trying to create a .touched event for when someone touches a part, lighting changes such as color correction and etc. However, this seems to fire for everyone and not just the person who’s touched its’ client.

This may be a small and dumb issue that I’m probably not aware of, but I have been trying to debug this for almost an hour and I can’t seem to get it working.

This is a LocalScript.

TouchPad.Touched:Connect(function(hit)
			if not debounce then
				debounce = true
				print("working")
				if hit then
					for i = 0, 1, 0.01 do
						ColorCorrection.Brightness = i
						wait(0.01)
					end
					wait(3)
					game.ReplicatedStorage.ServerTransparency:FireServer()
					for i = 1, 0.2, -0.01 do
						ColorCorrection.Brightness = i
						wait(0.01)
					end
					wait(1)
					for i, v in pairs(Character:GetDescendants(), Character:GetChildren()) do
						if v:IsA("BasePart") then
							v.Transparency = 0.5
							wait(0.01)
							HumanoidRootPart.Transparency = 1
						end
						if v:IsA("Decal") then
							v.Texture = ""
						end
					end
					HumanoidRootPart.Transparency = 1
					CCOutTween:Play()
					SoundService.AmbientReverb = "Bathroom"
					wait(120)
					debounce = false
					return
				end
		end
	end)

Help is very much appreciated!

Touched will fire regardless of who touched the part, even if it’s defined in a LocalScript.

If you want it so only the player can touch the part, just perform a check:

TouchPad.Touched:Connect(function(hit)
if game.Players.LocalPlayer.Character == hit.Parent then
--//do stuff
end
end)
1 Like

Seems to be working, thank you!

1 Like

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