Very simple camera script is not working

I have a very simple camera changing script, but it doesn’t work for some reason. Here it is:

game.ReplicatedStorage.RemoteEvents.PlayerJoined.OnClientEvent:Connect(function()
	print("Yar")
	local camera = game.Workspace.CurrentCamera
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = game.Workspace.SkyView.CFrame
end)

It does print Yar, and yes SkyView does exist. But it still dosent change the camera’s CFrame for some reason. It fires whenever someone new’s character spawns, so that might have to do with that. There are no errors, and the server script that fires the remote event is not important.

1 Like

Are there any errors?

If not, what does it do? Are you doing anything on the server we should be aware of? Why not do this all on the client?

Ok, I updated the post. (30) chars

This probably is “working” but it’s likely being over written when the character first spawns in, if so then waiting in general or waiting when the camera stuff is all set should take care of that.

2 Likes

The problem is if I make it wait a certain amount of seconds, it might fire a little later than when the character loads. The server script already waits for the character to spawn to fire the event. I guess that’s still too early.

If timing is in fact the issue here, then i would suggest waiting inside the event function instead of waiting to fire the event in general.

1 Like

I’ll test it out, thanks for the help!

Also just so you know, another option (likely better depending on your game or whatever you are trying to do ) could be to put a local script inside the StarterCharacterScripts to handle the “camera setting” stuff when the players spawns instead of using a remote event. Because scripts in StarterCharacterScripts are replicated when the player spawns. (Destroyed and then parented to the character)

3 Likes