RemoteEvent Problem

Hey fellow devs! I am working on an ATM robbery system and I was trying to add custom Camera CFrame while you are robbing the ATM but as yall can see it doesn’t work properly.

Client Script

local RS = game:GetService("ReplicatedStorage")
local RemoteEvent = RS.RemoteEvents.RobbingATM
local Camera = workspace.CurrentCamera

RemoteEvent.OnClientEvent:Connect(function(player, CameraPart)

	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = CameraPart.CFrame
	
	wait(2)

	Camera.CameraType = Enum.CameraType.Custom
end)

Server Script

local debounce = script.Parent.Parent.Cooldown
local AlarmLight = script.Parent.Parent["Alarm Light"].Light
local RS = game:GetService("ReplicatedStorage")
local RemoteEvent = RS.RemoteEvents.RobbingATM
local CamPart = script.Parent.Parent.CamPart

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	if debounce.Value == true then return end
		debounce.Value = true
	
	RemoteEvent:FireClient(player, CamPart)
	player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 2000
	
	for i = 1, 20 do
		AlarmLight.Material = Enum.Material.Neon
		AlarmLight.PointLight.Brightness = 1.6
			wait(0.7)
		AlarmLight.Material = Enum.Material.Glass
		AlarmLight.PointLight.Brightness = 0
			wait(0.7)
		end
	wait(100)
	debounce.Value = false
end)


By the looks of this error it seems like its the “CameraPart” Statement in the RemoteEvent that there is a problem with. I’ve tried alot of different things but none of them work.

Ty for reading hope yall able to help me!

Try “:FireClient(player, CamPart.CFrame)” and then just do “Camera.CFrame = CameraPart”

1 Like

try this client script instead

local RS = game:GetService("ReplicatedStorage")
local RemoteEvent = RS.RemoteEvents.RobbingATM
local Camera = workspace.CurrentCamera

RemoteEvent.OnClientEvent:Connect(function(CameraPart)

	Camera.CameraType = Enum.CameraType.Scriptable
	Camera.CFrame = CameraPart.CFrame
	
	task.wait(2)

	Camera.CameraType = Enum.CameraType.Custom
end)

Gives me this error:
Unable to assign property CFrame. CoordinateFrame expected, got nil - Client - ATM_ROB_CAMERA:8

on the “OnClientEvent” function remove “player” as the first argument and leave “CameraPart”

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.