So, I’m making a Third Person Shooter game with my friend. Now I’ve a module script called _CameraV2 (Cuz V1 was not working properly). I’ve a local script called Menu inside of the MainMenu gui (ScreenGui). When the deploy button is clicked it fires a remote event and in the server it receives and fires another remote event.
Now I’ve a local script inside StarterGui which is called Client. I receive the 2nd remote event in the client and set the ThirdPersonCameraConnection (A variable) to be the third person function inside the module script. I returned "ThirdPersonCamera" to print it out in the 2nd remote event receiving. It does print it out but it doesn’t disconnect the function.
(If script is needed I’ll send it in the replies.)
What does the actual function contain? Is it a renderstepped connection that runs every frame (typically for most camera modules)? If so then are you making sure to disconnect that?
Otherwise, even if it disconnects you might want to reset the camera (if it’s set to scriptable idk whats in your camera module). Then this post should be helpfull for that purpose of resetting camera back to the player.
You could set a variable, then check if it is enabled at the start of the renderstepped. When you want it to no longer run, just change the value of the variable
You could do it something like
local RunService = game:GetService("RunService")
local ThirdPerson = true
RunService.RenderStepped:Connect(function(step)
if ThirdPerson then
--code goes here
end
end)
remoteEvent.OnClientEvent:Connect(function()
ThirdPerson = false
end