In a local script, under PlayerGui, I have a gui object, and in it I have this event…
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
HandleChanged(input)
elseif input.UserInputType == Enum.UserInputType.Touch then
HandleChanged(input)
end
end)
When the character resets, the PlayerGui objects are destroyed.
So, will this event need a disconnect somewhere, considering it is attached to UserInputService?
And if I do need to disconnect it, where and how would I do this?
I tried to assign it a varaible…
local event = UserInputService.InputChanged:Connect(function(input) ...
then check for
game.Players.LocalPlayer.CharacterRemoving:Connect(function() event:Disconnect() end)
however, when I reset, the output told me ‘event’ was a nil value.