of     1   

RealFrantic
#228352780Saturday, December 02, 2017 11:41 PM GMT

I finally got a gui to work that I have been working on for a while, It works whenever I run it in studio. But when I play the actual game, when I click the gui text button, it doesnt change the camera. Does anyone know why this happens? Here is my normal script under textbutton, under screengui, under startergui: local Camera = workspace.CurrentCamera function onClicked(GUI) Camera.CameraType = Enum.CameraType.Scriptable Camera.CFrame = workspace.CustomizePart.CFrame-- CustomizePart is the part that the camera switches to script.Parent.Parent:remove()--This removes the gui once the camera has changed. end script.Parent.MouseButton1Click:connect(onClicked)
Denny9876
#228353173Saturday, December 02, 2017 11:50 PM GMT

I have a script similar to this. I think you have to use Camera.CoordinateFrame, not CFrame by itself. For example : local Camera = workspace.CurrentCamera function onClicked(GUI) Camera.CameraType = Enum.CameraType.Scriptable Camera.CoordinateFrame = CFrame.new(workspace.CustomizePart.Position) script.Parent.Parent:remove() end script.Parent.MouseButton1Click:connect(onClicked) Also make sure the script is a localscript. I'm using a localscript in StarterGui for my camera script and I think it won't work with server scripts.
RealFrantic
#228353402Saturday, December 02, 2017 11:55 PM GMT

Omg! Thank you so much! Works perfectly! I'll remember to use the same method the next time ;)
Denny9876
#228353694Sunday, December 03, 2017 12:01 AM GMT

No problem. :P
JarodOfOrbiter
#228353862Sunday, December 03, 2017 12:05 AM GMT

CoordinateFrame is the old way of doing it. Now, make sure you use Cam.CFrame, it is the correct way of doing it. Your code is fine the way it is, but make sure it is a LocalScript.

    of     1