What I'm doing is I want to make a system where when the player presses E, it'll move on to the next celestial body. When the player presses Q, it moves to the previous.

Here's my two scripts:

LocalScript in PlayerGui

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(keyCode)
	if keyCode.keyCode == Enum.KeyCode.E then
		game.ReplicatedStorage.pressedE:FireServer()
	end
	if keyCode.keyCode == Enum.KeyCode.Q then
		game.ReplicatedStorage.pressedQ:FireServer()
	end
end)

ServerScript in IntValue "Planets"

local Planets = script.Parent
local CurrentPlanet = script.Parent.CurrentPlanet
local Info = script.Parent.Info
local Gravity = script.Parent.Gravity

local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable

local planetViewing

script.Parent.Changed:Connect(function()
	if Planets.Value == 1 then
		planetViewing = workspace.Mercury.Surface
		Camera:Interpolate(planetViewing.CFrame,planetViewing.Parent.Cam.CFrame,1.5)
		CurrentPlanet = workspace.Mercury
	end
end)
game.ReplicatedStorage.pressedE.OnServerEvent:Connect(function()
	script.Parent.Value = script.Parent.Value + 1
end)
game.ReplicatedStorage.pressedQ.OnServerEvent:Connect(function()
	script.Parent.Value = script.Parent.Value - 1
end)

However, when I test the game, the camera doesn't even change to Scriptable.

I am very confused, because this used to work for me.

Can anyone help please?

5 comments

0

server cannot access client camera. server handles multiple clients not just one. have to do on client

0

just do all the camera code on client. server does not need to be involved

0

ok

0

Yeah.

0

Hey! I was asking my self. On your answer I see those "Titles" [Text a little bit bigger and in bold]. How I can do that ?