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

Why isn't my CameraType Value not changing?

-- Script

game.ReplicatedStorage.ChangeCam.OnServerEvent:Connect(function(player)
	game.Workspace.CurrentCamera.CameraType = "Custom"
end)

-- LocalScript

playframe.ep1.TextButton.MouseButton1Click:Connect(function()
  	game.ReplicatedStorage.ChangeCam:FireServer()
end)

CameraType value won't change.

5 comments

0

I recommend you create an event that destroys what you spit out to the server. A client --> Server RemoteEvent, also you could make another one that changes the value of the CameraType.

0

Remote Event fixed the Destroy, but it's not changing the CameraType.

0

Never mind, remoteevent didn't fix anything...

0

did you use the remote event correctly and call the event accordingly? (fire server and fire client)

0

I figured out the :Destroy(), but the CameraType value still won't change.

2 answers

✓ Accepted answer

You cant change the camera on the server like that, heres what you should do from a local script, since youre clicking on a GUI Object.

--Local script

repeat workspace.Camera.CameraType = Enum.CameraType.Scriptable; wait()
until workspace.Camera.CameraType == Enum.CameraType.Scriptable
 
script.Parent.MouseButton1Click:Connect(function() --an image button
   workspace.Camera.CameraType = Enum.CameraType.Custom
end)

Hers a gif of what happens: https://gyazo.com/c5398b59c7f8e29024f7ca90f226bd62

2 comments

0

Also the repeat loop is a good method to make sure the camera is scriptable, since sometimes roblox gives the player custom camera after the initial property was set from the script.

1

Thank you!

try changing this line: playframe.ep1.TextButton.MouseButton1Click:Connect(function() to this

playframe["ep1"].TextButton.MouseButton1Click:Connect(function()

1 comment

1

That's literally the same thing... Won't change anything.

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