Changing players camera

When I change the CurrentCamera of a player, everyone in the entire server’s camera is changed. Here is the script:

game.ReplicatedStorage.Events.OpenShop.OnClientEvent:Connect(function()
	
	local playerGui = script.Parent
	local camera = workspace.CurrentCamera
	
	if playerGui.Shop.Opened.Value == false then
	
		camera.CameraType = Enum.CameraType.Scriptable
		camera.CameraSubject = workspace.Shop.Cameras.CamPart1
		camera.CFrame = workspace.Shop.Cameras.CamPart1.CFrame
		
		game.ReplicatedStorage.Events.AddCam:FireServer()
		
		for i, v in pairs(playerGui:GetChildren()) do
			
			if v.ClassName == "ScreenGui" then
				
				v.Enabled = false
				
			end
			
		end
		
	end
	playerGui.Shop.Enabled = true
	
end)

The for loops just get rid of the rest of the UI when it is fired. This is also a LocalScript meaning that it shouldn’t (at least I am aware of) change the server unless it is an animmation I am pretty sure.

3 Likes

I would personally be doing this on the client side,

Since this CurrentCamera is being accessed from the server I’m going to assume this is probably the cause of what’s making it edit everyones camera. I would do some research though to see if theirs already a solution. Camera | Documentation - Roblox Creator Hub

4 Likes

I found some text saying: " Each client’s particular Camera object can be accessed through the Workspace.CurrentCamera property of the Workspace on that client."

This what I did and I did it through a LocalScript.

1 Like

How are u firing openShop? (30)

1 Like

I already fired it. This is the script that will run as soon as it is fired.

1 Like

I used a fired it by using a Touch command

Local scripts doesnt have the ability to mess everyones camera…

So there must be a lroblem on the server

1 Like

Exactly. This is my point. This is the script that changes it and it keeps doing this.

1 Like

Just let me see the touch event

1 Like

Here you go it is just a generic touch event:

script.Parent.Touched:Connect(function(hit)
	
	local human = hit.Parent:FindFirstChild("Humanoid")
	
	if (human~=nil) then
		
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		
		game.ReplicatedStorage.Events.OpenShop:FireClient(player)
		
	end
	
end)
1 Like

Well thats okay… what about addCam?

1 Like

That is just a event I used to add to an IntValue. That does nothing in particular to this script.

1 Like

Okay I dont know whats the problem then, I hope u find a solution, gl

2 Likes

I think I know you’re problem!

Can you go to Workspace, and inside Workspace’s properties, scroll down until you find the filtering enabled property.
Is it checked or unchecked? If it’s unchecked, that’s your problem. Filtering Enabled was added so that exploiters can’t exploit the server. Without this, a change a client made would be seen by the whole server!

This also means changes made by LocalScript’s can be seen by everyone.

How to turn filtering enabled off( images)

  1. Go to workspace.

Is the filtering enabled property on or off?

1 Like