Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Would this event continue indefinitely?

I've created a local script in which a Camera is manipulated to view a different object, when the player clicks they're returned to viewing their character.

Would the Mouse.Button1Down:connect(ActiveCamera) event continue until the script was removed, or would it be nulled upon function completion. If it is a lasting event please give advice on how to fix it.

Code :

local RepS = game:GetService("ReplicatedStorage")
local Remote = RepS.Remote
local CameraEvent = Remote.CEvent

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

CameraEvent.OnClientEvent:connect(function(Camera)
	local Cam = workspace.CurrentCamera
	local Character = workspace[Player.Name]
	
	Cam.CameraSubject = Camera
	
	local ActiveCamera = function()
		if not Character:FindFirstChild("Head") then return end
		Cam.CameraSubject = Character.Head
		return
	end
	
	Mouse.Button1Down:connect(ActiveCamera)
	return
end)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.