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

CameraType not changing when button clicked?

i made a script that when you press the TextButton it changes the camera type. Here is the script

sorry the title sounds weird nothing would work D:

local clicked = 1

script.Parent.MouseButton1Click:connect(function(a)
	clicked = clicked + 1
	print(clicked)
end)

local a = game.Players.LocalPlayer

if clicked == 1 then
	local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Custom

end
if clicked == 2 then
	local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Attach
end

What is wrong with the script?

1 answer

✓ Accepted answer

The problem is, the if statements will only run once. What u need to do is, put both if statements in the MouseButton1Click'ed function.

1 comment

0

Also, set Clicked = 0

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