You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to send a part from the server to client -
What is the issue? Include screenshots / videos if possible!
the part is returning nil on the client -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
searching on the dev forum but nothing worked
Server:
local repStorage = game:GetService("ReplicatedStorage")
local remoteEventsFold = repStorage:WaitForChild("RemoteEvents")
local changeCamEvent = remoteEventsFold:WaitForChild("ChangeCamRE")
local shackFold = game.Workspace:WaitForChild("Shack")
local camPosFold = shackFold:WaitForChild("CamerasPos")
local deskCam = camPosFold:WaitForChild("DeskCam")
local function setUp(plr)
print("hi")
changeCamEvent:FireClient(plr, deskCam)
end
game.Players.PlayerAdded:Connect(function(plr)
setUp(plr)
end)
Client:
local plr = game:GetService("Players").LocalPlayer
local repStorage = game:GetService("ReplicatedStorage")
local remoteEventsFold = repStorage:WaitForChild("RemoteEvents")
local changeCamEvent = remoteEventsFold:WaitForChild("ChangeCamRE")
local cam = game.Workspace.CurrentCamera
changeCamEvent.OnClientEvent:Connect(function(deskCam)
print(deskCam)
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = deskCam.CFrame
end)