Value doesn't change because character has changed

this is a local script changing the character into a custom rig but, the value “Nval” won’t change. The goal was to transform the character and give it abilities but the check that checks if the character is transformed won’t update(Nval).

local RS = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local CubeShiftEvent = RS:WaitForChild("CubeShiftEvent")
local NVal = false
local CubeShiftEvent = RS:WaitForChild("CubeShiftEvent")
local model = game.ReplicatedStorage.StarterCharacter
--
local VoidShift = RS:WaitForChild("Void")
local isRunning = false

UIS.InputBegan:Connect(function(input,gameProcessed)

	print("Starting our connection with NVAL having the value of ", tostring(NVal))
	if not gameProcessed then

		if input.UserInputType == Enum.UserInputType.Keyboard then
			if input.KeyCode == Enum.KeyCode.E then
				print(" has been set", NVal)
				CubeShiftEvent:FireServer(model)
				wait(3)
				NVal = true
				
			end
			
			end
	end
	
	

	if input.UserInputType == Enum.UserInputType.Keyboard then
		if input.KeyCode == Enum.KeyCode.Z and NVal then
			   print("Nval Is",NVal)
		else
			print("nth")

  end
end
	
	end)

Any errors? I suspect you to be getting one from firing the event.

no, i don’t get any errors at all it just doesn’t work