I've created a camera script that changes the players camera to rotate around a brick, but for some reason, when someone touches the specific brick, it is changing every players camera to rotate around the brick.
It is meant to only work for the person that touched the brick.
The camera script is located in Game/StarterGui/CameraScript(script)
IT IS a local script. Filtering Enabled is NOT on.
local player = game.Players.LocalPlayer local Hub = game.Workspace.Hub game.Workspace.Finish.Touched:connect(function(Brick) local Player = Brick.Parent:findFirstChild("Humanoid") Player.Parent.Torso.CFrame = CFrame.new(Hub.Position+Vector3.new(0, 3, 0)) game.Workspace.CurrentCamera.CameraSubject = game.Workspace.FocusHere game.Workspace.CurrentCamera.CameraType = "Custom" local finished = false local Angle = 0 local Position = 0 game.Players.LocalPlayer.CameraMaxZoomDistance = 20 game.Players.LocalPlayer.CameraMinZoomDistance = 20 game.Players.LocalPlayer.PlayerGui.RotateScreenAbility.Frame.Visible = true while finished == false do game.Workspace.CurrentCamera.CoordinateFrame = game.Workspace.FocusHere.CFrame * CFrame.Angles(0, Angle, Angle) * CFrame.new(Position, Position, Position) Angle = Angle + math.rad(1) Position = Position + .08 wait(.001) end wait(5) game.Workspace.CurrentCamera.CameraSubject = player.Character.Humanoid game.Workspace.CurrentCamera.CameraType = "Follow" end)
Please help ASAP!
We can do this with the :IsDescendantOf
function.
Example,
local player = game.Players.LocalPlayer local Hub = game.Workspace.Hub local char = plr.Character or plr.CharacterAdded:wait() game.Workspace.Finish.Touched:connect(function(Brick) if Brick:IsDescendantOf(char) then local Player = Brick.Parent:findFirstChild("Humanoid") Player.Parent.Torso.CFrame = CFrame.new(Hub.Position+Vector3.new(0, 3, 0)) game.Workspace.CurrentCamera.CameraSubject = game.Workspace.FocusHere game.Workspace.CurrentCamera.CameraType = "Custom" local finished = false local Angle = 0 local Position = 0 game.Players.LocalPlayer.CameraMaxZoomDistance = 20 game.Players.LocalPlayer.CameraMinZoomDistance = 20 game.Players.LocalPlayer.PlayerGui.RotateScreenAbility.Frame.Visible = true while finished == false do game.Workspace.CurrentCamera.CoordinateFrame = game.Workspace.FocusHere.CFrame * CFrame.Angles(0, Angle, Angle) * CFrame.new(Position, Position, Position) Angle = Angle + math.rad(1) Position = Position + .08 wait(.001) end wait(5) game.Workspace.CurrentCamera.CameraSubject = player.Character.Humanoid game.Workspace.CurrentCamera.CameraType = "Follow" end end)
Good Luck!