- The main error I’m getting on this script is when firing a remote event to the client when trying to change the Camera’s properties.
(LOCAL SCRIPT) LOCATED IN StarterCharacterScripts
V
local RepStorage = game:GetService("ReplicatedStorage")
local FactoryCameraEvent = RepStorage.FactoryCamera
local Camera = game:GetService("Workspace").CurrentCamera
local ChangeCameraEvent = RepStorage:WaitForChild("ChangeCameraEvent")
local Factories = game:GetService("Workspace").FactoryNodes
local Player = game:GetService("Players").LocalPlayer
RepStorage.ChangeCameraEvent.OnClientEvent:Connect(function()
local FacNodes = Factories:GetChildren()
for _, Node in FacNodes do
local defaultFactory = Node:FindFirstChild("DefaultFactory")
if defaultFactory and defaultFactory:FindFirstChild(tostring(Player.UserId)) then
local CameraPart = Node:FindFirstChild("DefaultFactory").CameraPart
if CameraPart then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.FieldOfView = 28
Camera.CFrame = CameraPart.CFrame
end
end
end
end)
(SERVER SCRIPT) ServerScriptService
V
local Players = game:GetService("Players")
local Factories = game:GetService("Workspace").FactoryNodes
local TouchedTeleporter = script.Parent
local RepStorage = game:GetService("ReplicatedStorage")
TouchedTeleporter.Touched:Connect(function(touched)
if touched.Parent:IsA("Model") and touched.Parent:FindFirstChild("Humanoid") then
local Player = Players:GetPlayerFromCharacter(touched.Parent)
if Player then
local FacNodes = Factories:GetChildren()
for _, Node in FacNodes do
local defaultFactory = Node:FindFirstChild("DefaultFactory")
if defaultFactory and defaultFactory:FindFirstChild(tostring(Player.UserId)) then
local FacTeleporter = Node:FindFirstChild("DefaultFactory").ReplicatedTeleporter
local HumanoidRP = Player.Character:FindFirstChild("HumanoidRootPart")
if FacTeleporter then
if HumanoidRP then
RepStorage.ChangeCameraEvent:FireClient()
HumanoidRP.CFrame = FacTeleporter.CFrame
end
end
end
end
end
end
end)
- I’ve never used RemoteEvents before so I am not familiar with these errors.