When a player touches the part, everyone's camera goes to the same position. How can I fix this? It's a local script in starter pack and no errors
local plr = game.Players.LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local cam = workspace.CurrentCamera local debounce = false workspace.ShopCam.Touched:Connect(function(hit) if debounce == true then return end if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:IsA("Model") then debounce = true char:FindFirstChild("Humanoid").WalkSpeed = 0 repeat wait() cam.CameraType = Enum.CameraType.Scriptable until cam.CameraType == Enum.CameraType.Scriptable cam.CFrame = workspace.CamPart.CFrame if plr.PlayerGui.ToolShop.Frame.Visible == true then wait(5) debounce = false end end end) plr.PlayerGui:WaitForChild("ToolShop").Frame.Close.MouseButton1Click:Connect(function() cam.CameraType = Enum.CameraType.Custom char:FindFirstChild("Humanoid").WalkSpeed = 16 end)
On line 11, we should make sure that:
hit.Parent = plr.Character
Otherwise, any player who touches ShopCam will trigger it.