Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why isn't my CameraType Value not changing?

Asked by
Jxdenx 45
4 years ago
Edited 4 years ago

-- 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.

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. SevenDevelopment 2 — 4y
0
Remote Event fixed the Destroy, but it's not changing the CameraType. Jxdenx 45 — 4y
0
Never mind, remoteevent didn't fix anything... Jxdenx 45 — 4y
0
did you use the remote event correctly and call the event accordingly? (fire server and fire client) KDarren12 705 — 4y
0
I figured out the :Destroy(), but the CameraType value still won't change. Jxdenx 45 — 4y

2 answers

Log in to vote
0
Answered by
Psudar 882 Moderation Voter
4 years ago

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

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. Psudar 882 — 4y
1
Thank you! Jxdenx 45 — 4y
Ad
Log in to vote
0
Answered by
Cjjdawg -9
4 years ago

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

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

1
That's literally the same thing... Won't change anything. Jxdenx 45 — 4y

Answer this question