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

Disconnected event because of exception, why?

I am new to scripting Lua on ROBLOX. I've been trying to code a Scriptable Camera but it keeps saying, in the Output window, "Disconnected event because of exception. I am testing in 'Solo Play' and Server Play. Why does it keep saying this phrase? Here's the script:

function onTouch(Part)
	
	run = game:GetService("RunService")
	c = Workspace.Camera
	c.CameraType = "Scriptable"
	Pos = Vector3.new(0, 50, -50)
	Targ = game.Workspace.Dead1.Torso.Position
	Zaxis = -50
	Zoom = 40
for tehloop = 1, 100 do
	if tehloop < 100 then	
	Zoom = Zoom -0.5
	c.FieldOfView = Zoom
	Zaxis = Zaxis +1
	Pos = Vector3.new(0, 50, Zaxis)
	c.CoordinateFrame = CFrame.new(Pos.Targ)
	else
	Zoom = Zoom -1
	c.FieldOfView = Zoom
	end
	run.Stepped:wait(0.1)
end
wait(10)
c.FieldOfView = 50
c.CameraType = "Custom"
end

GUIPBr.Touched:connect(onTouch)

If anyone can help me with this, that would be very helpful. Thank you!

2 comments

0

Please edit your original question instead of asking a new one, in the future.

2

This should be a LocalScript and c should be Workspace.CurrentCamera

1 answer

✓ Accepted answer

Like Shawnyg said, at line 5 in that block, you need Workspace.CurrentCamera.

As well, this has to be in a LocalScript to work.

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