Each time, I jump out of the seat, the number of times the button was pressed, adds by one

More info in the video:

So you see in the video my output. It prints “and?” each time I press a button and the BSOD is visible. But for some reason, the detection of the player is broken and each time I sit back on the seat, it multiplies (+1)…

Instead of going

and?
and? (x2)
and? (x3)

The second time, it goes

and? (x2)
and? (x4)
and? (x6)

And it goes on and on…

Also the third time

and? (x3)
and? (x6)
and? (x9)

wait()
local Seat = game.Workspace.House.Seat:FindFirstChildWhichIsA("Seat")

if Seat then
	Seat.Changed:Connect(function()
			print("Found It!")
			if Seat.Occupant == nil then
				game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
				game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid")
			else
				if Seat.Occupant:IsA("Humanoid") then
					game.Workspace.CurrentCamera.CameraSubject = game.Workspace
					game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
					game.Workspace.CurrentCamera.CFrame =  CFrame.new(Vector3.new(-0.066, 5.004, -9.333), Vector3.new(0, 0, -180))
					-- Keyboard
					local Player = game.Players.LocalPlayer
					local UIS = game:GetService('UserInputService')

					UIS.InputBegan:Connect(function(input)
						if game.Workspace.House.MainComponentWhichEqualsToMonitor.MainPart.MainPart.MonitorPanel.HardwareErrorSoD.Visible == true and Seat.Occupant:IsA("Humanoid") then
							print("and?")
						elseif Seat.Occupant == nil then
							print("You arent sitting infront of the computer!")
						end
					end)
				end
			end
		
	end)
else
	print("No Seat Found")
end

Honestly this sounds like your script is replicating itself somehow.
Check in your Seat.Changed event if the Occupant is nil, if so, try destroying the script.
My guess is that the UIS.InputBegan function replicates everytime you sit on the char and it repeats the process in that function for example 3 times.
That’s why “and?” Is printed 3 times.

1 Like

Lets say that fixed the issue.

I created a new LocalScript and put the UIS inside it.

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