iekqg
(Baconhairfan)
September 3, 2022, 10:15pm
#1
Hello,
Since today, I’ve been trying to change the player’s current camera type with a script. The script works with a local script, but not with a script.
I was unable to figure that out how to make it. The script does not work for some reason.
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end)
Does anyone know how to make it? - Thanks
2 Likes
Katrist
(Katrist)
September 3, 2022, 10:16pm
#2
LocalScripts only run in these places:
You will need to put your script in StarterPlayerScripts and change the variables.
If you’re doing this with a server script, use RemoteEvents to communicate to the client what to do.
1 Like
Valkyrop
(JustAGuy)
September 3, 2022, 10:16pm
#3
You should fire a remote , to that client and then change the camera on the client.
You should use FireClient
Server Script:
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
game:GetService("ReplicatedStorage").Cam:FireClient(plr)
end)
Local Script:
local replicated = game:GetService("ReplicatedStorage")
replicated:WaitForChild("Cam").OnClientEvent:Connect(function()
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end)
3 Likes