I do understand that there is a default camera, but I am making a cut-scene for games, and every time one player steps on the activation brick, everyone goes through the cut-scene.. Can I get help with this problem? Here is the script:
wait(3) local TweenService = game:GetService("TweenService") local Camera = game.Workspace.CurrentCamera local function MoveCamera(StartPart, EndPart, Duration, EasingStyle, EasingDirection) Camera.CameraType = Enum.CameraType.Scriptable Camera.CFrame = StartPart.CFrame local Cutscene = TweenService:Create(Camera, TweenInfo.new(Duration, EasingStyle, EasingDirection), {CFrame = EndPart.CFrame}) Cutscene:Play() wait(Duration) end local function Cutscene() MoveCamera(game.Workspace.Camera, game.Workspace.PartA, 1.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut) MoveCamera(game.Workspace.PartA, game.Workspace.PartA, 0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut) MoveCamera(game.Workspace.PartA, game.Workspace.PartB, 1.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut) MoveCamera(game.Workspace.PartB, game.Workspace.PartB, 0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut) MoveCamera(game.Workspace.PartB, game.Workspace.PartC, 1.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut) MoveCamera(game.Workspace.PartC, game.Workspace.PartC, 0.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut) MoveCamera(game.Workspace.PartC, game.Workspace.PartD, 1.5, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut) MoveCamera(game.Workspace.PartD, game.Workspace.PartD, 0.2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut) wait(.5) Camera.CameraType = Enum.CameraType.Custom Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") end local enabled = false workspace.brick.Touched:Connect(function(plr) if enabled == true then return end enabled = true plr.Parent.Humanoid.WalkSpeed = plr.Parent.Humanoid.WalkSpeed == 0 plr.Parent.Humanoid.JumpPower = plr.Parent.Humanoid.WalkSpeed == 0 Cutscene() plr.Parent.Humanoid.WalkSpeed = 16 plr.Parent.Humanoid.JumpPower = 50 wait(2) enabled = false end)
Thank you to anyone who can help me with this!
Here's the solution:
Add an if statement
to the start of the touch fuction checking if who touched the part has the same name of the local player, if yes, run your code, else do something that you want or just dont. Also add a local variable called player
and assign it to the local player.
The function would look like this:
local player = game:GetService("Players").LocalPlayer workspace.brick.Touched:Connect(function(plr) if player.Name == plr.Parent.Name then if enabled == true then return end enabled = true plr.Parent.Humanoid.WalkSpeed = plr.Parent.Humanoid.WalkSpeed == 0 plr.Parent.Humanoid.JumpPower = plr.Parent.Humanoid.WalkSpeed == 0 Cutscene() plr.Parent.Humanoid.WalkSpeed = 16 plr.Parent.Humanoid.JumpPower = 50 wait(2) enabled = false end end end)
Sorry for the late response!