I want to make this code down here, only work for the localplayer's camera.
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera local Part3 = game.Workspace.Part3 game.Workspace.Part3.Touched:connect(function() Camera.CameraType = Enum.CameraType.Scriptable Camera.CFrame = workspace.CameraParts3.CFrame wait(2) Camera.CFrame = workspace.CameraPart2s3.CFrame wait(3) Camera.CFrame = workspace.CameraPart3s3.CFrame wait(2) Camera.CFrame = workspace.CameraPart4s3.CFrame end)
**right now it changes the camera of everyone in the game to those parts. i wanna make it so it only becomes the camera of the CLIENT when the CLIENT touches the part. **
FYI THIS IS A LOCALSCRIPT IN STARTERPACK
Try this:
local Player = game.Players.LocalPlayer local Players = game:GetService("Players") local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera local Part3 = game.Workspace.Part3 game.Workspace.Part3.Touched:connect(function(plr) local TouchPlayer = Players:GetPlayerFromCharacter(plr.Parent.Name) if TouchPlayer == Player.Name then Camera.CameraType = Enum.CameraType.Scriptable Camera.CFrame = workspace.CameraParts3.CFrame wait(2) Camera.CFrame = workspace.CameraPart2s3.CFrame wait(3) Camera.CFrame = workspace.CameraPart3s3.CFrame wait(2) Camera.CFrame = workspace.CameraPart4s3.CFrame end end)
EDIT: Please show a video of it happening to more players and a picture of the explorer.
There's a good chance this is because the script is a server script, with guis, server scripts replicate everything to every client (correct me if I'm wrong).
When the script sees anything touches it runs for everyone. FIX:
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera local Part3 = game.Workspace.Part3 Part3.Touched:connect(function(Hit) if Hit.Parent == Character then Camera.CameraType = Enum.CameraType.Scriptable Camera.CFrame = workspace.CameraParts3.CFrame wait(2) Camera.CFrame = workspace.CameraPart2s3.CFrame wait(3) Camera.CFrame = workspace.CameraPart3s3.CFrame wait(2) Camera.CFrame = workspace.CameraPart4s3.CFrame end end)