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

Camera Type Not Changing?

Asked by 3 years ago

I am trying to make a Remote Event that changes everyone's camera type and for some reason it is not working after trying multiple ways, can anyone help? The entire script has been pasted below.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CamAll = ReplicatedStorage:WaitForChild("CamAll")
local cam = workspace.Camera
local CamPart = game.Workspace.CamPart

CamAll.OnServerEvent:Connect(function()
    local FocusPart = game.Workspace.FocusPart
    print("Cam Enabled.")
    repeat wait()
        cam.CameraType = Enum.CameraType.Scriptable
    until cam.CameraType == Enum.CameraType.Scriptable
    cam:Interpolate(CamPart.CFrame, FocusPart.CFrame, 0.5)
    script.Parent.Visible = false
    script.Parent.Parent.Disable.Visible = true
    wait(0.2)
end)
0
why is there a repeat wait() in the middle of your code? Gmorcad12345 434 — 3y
0
It repeats changing the camera type until theer camera type is equal to scriptable, but the camera is not changing Eletrinn 4 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

From what it seems, you're manipulating the camera on the Server-side, which isn't possible. You need to do it on the client.

Instead of calling the RemoteEvent from the client, call it from the server with :FireAllClients and set up a OnClientEvent: in PlayerScripts.

0
This works however it only affects whoever clicks the enable button at which point no remote events are needed. I am trying to make it so when I press a Text button on a hidden screen gui only I can see it affects all players cameras. Is there a way to do this? Eletrinn 4 — 3y
0
bruh he literally told you to use OnClientEvent and FireAllClients to change EVERYONE'S camera birds3345 177 — 3y
0
I have and it only affects the person who clicks the button. Eletrinn 4 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

As said lightifieds you need to this on client not on server, Also Camera is not players camera is your studio camera when you run a code from console bar you can set your camera cframe to part like if you are in player mode so you need be on client and use CurrentCamera because that is player camera

Answer this question