Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why is my CameraType not changing in my serverscript?

Asked by 5 years ago
Edited 5 years ago

I made a serverscript that changes the view of the camera. When the script is ran it does not change the cameratype to scriptable and it is not throwing any errors. This script works flawlessly in a localscript but in a localscript the camera will change for all players but with what I'm doing I only want the camera to change for only the player that touched a part.

0101  local cam = workspace.Camera
0202  local focus = game.Workspace.col1
0303  local tween = game:GetService("TweenService")
0404  local active = false
0505  
0606  game.Workspace.Shop.Touched:Connect(function(hit)
0707      if not active then
0808          active = true
0909          local humanoid = hit.Parent:FindFirstChild("Humanoid")
1010          local player = game.Players:GetPlayerFromCharacter(hit.Parent)
1111          local root = hit.Parent:FindFirstChild("HumanoidRootPart")
1212          Iterator = 1
1313          if humanoid ~= nil then
1414              humanoid.WalkSpeed = 0
1515              cam.CameraType = Enum.CameraType.Scriptable
View all 94 lines...

2 answers

Log in to vote
0
Answered by 5 years ago

you can manipulate camera in a localscript only.. because a camera is "local" to a player

0
Thanks. I must have gotten some wrong advice earlier, because someone told me to make it a serverscript. IProgram_CPlusPlus 58 — 5y
0
Happy to help (: User#23252 26 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Also, to fix the camera changing for all players, for the variable "cam" do

1local cam = game:GetService("Workspace").CurrentCamera

wich will get only the player's camera.

Answer this question