Answered by
4 years ago Edited 4 years ago
To change a specific player's camera, you need to use a LocalScript, because you need to use CurrentCamera, which can only be accessed by a LocalScript.
In a LocalScript.
1 | local Camera = Workspace.CurrentCamera |
4 | Camera.CameraType = Enum.CameraType.Scriptable |
7 | Camera.CFrame = CameraPart.CFrame |
To make the function activate when playing a piece, you can create a RemoteEvent inside the piece you want, create the base code for when the piece is played, and trigger the event for the specific customer.
1 | local Part = script.Parent |
2 | local RemoteEvent = Part.RemoteEvent |
4 | Part.Touched:Connect( function (Hit) |
5 | local Player = game.Players:GetPlayerFromCharacter(Hit.Parent) |
7 | RemoteEvent:FireClient(Player) |
Now you need a Local Script inside this part that detects that RemoteEvent was triggered as a client, so put the first code inside the function.
01 | local RemoteEvent = (Find the RemoteEvent) |
03 | RemoteEvent.OnClientEvent:Connect( function (Player) |
I don't know if there is another way to do this, but that was the solution I found :)
Any questions, you can ask.
:)