[Repost] Local Script doesn't function as intended

At the current time, I have been working on something for a while which doesn’t work.
Works the first time until the value changes.
Basically, When a value changes, I want it to reconnect onto a object that holds remotes, However it doesn’t work.

local mouse = game.Players.LocalPlayer:GetMouse()
shared.bruh = game.Players.LocalPlayer.Backpack:WaitForChild("Ability")
local userinpserv = game:GetService("UserInputService") --//UNUSED BECAUSE I GOT CONFUSED!
local val = game.Players.LocalPlayer:WaitForChild("Chosen")
local disable = false
autoupdate = false
repeat wait() until shared.bruh
--print("Check!")
while wait(0.1) do
	print(shared.bruh)
	if autoupdate == false then
		autoupdate = true
mouse.KeyDown:Connect(function(key)
	if disable == false then
				if shared.bruh ~= nil then
					local bruh2 = shared.bruh:GetChildren()
		--print(key)
		for i=1, #bruh2 do
			if bruh2[i]:IsA("RemoteEvent") then
				--print("Yes!")
				if bruh2[i].Name == key then
					--print("Yes! 2")
					print("Event Attempted")
				bruh2[i]:FireServer()
				end
			end
		end
		end
	end
	end)
	--print("Check!")
mouse.KeyUp:Connect(function(key)
	if disable == false then
				if shared.bruh ~= nil then
		--print(key)
					local bruh5 = shared.bruh:GetChildren()
		for i=1, #bruh5 do
			if bruh5[i]:IsA("RemoteEvent") then
				--print("Yes!")
				if bruh5[i].Name == ""..key.."Up" then
					--print("Yes! 2")
					print("Event Attempted2")
					bruh5[i]:FireServer()
				end
			end
			end
		end
	end
	end)
mouse.Button1Down:Connect(function()
	if disable == false then
				if shared.bruh ~= nil then
					local bruh2 = shared.bruh:GetChildren()
		for i=1, #bruh2 do
			if bruh2[i].Name == "LMB" then
				print("Event Attempted3")
				bruh2[i]:FireServer()
			end
		end
		end
			end
		
	end)
	end
end
val.Changed:Connect(function(newval)
	local test = game.Players.LocalPlayer.Backpack:GetChildren()
	local shm = nil
	for i=1, #test do
		if test[i]:IsA("Script") then
			--probably a stand script
			if test[i]:FindFirstChild("Removing") ~= nil then
				--It is
				if test[i]:FindFirstChild("Removing").Value == false then
					shm = test[i]
				end
			end
		end
	end
	wait(0.4)
	if shm ~= nil then
	print("Updated Inputs.")
	shared.bruh = shm
		autoupdate = false
		end
	
	end)

Thank you for at least trying to help because this was suffering.

remote events dont store data.

I am not storing data. I am trying to fire Remote events that have the same name as the letter you press. It works until your Chosen value changes, and I want the cycle to continue.

Fixed by disabling and reenabling the script again.