I have a remote event that seems to be failing to pass values. While most remote events pass their values correctly, this one, in particular, seems to pass nothing but nil. I run a print right before the sender (a server script) fires the event, so I know the sender is passing the values right to the event. the print right after the event in the receiver, however, always gives all nils.
Sender (Server Script)
event = game.ReplicatedStorage.PreviewRequest
event.OnServerEvent:Connect(function(player, source, item)
print("Fired")
--local gui = player.PlayerGui.InventoryGui.Frame.DescriptionFrame.WorkingViewportFrame
if item == "Campfire Kit" or item == "Heater Kit" then
item = game.ServerStorage.Entities[string.sub(item, 1, -4)]
else
item = game.ServerStorage[item]
end
item = item:Clone()
print(player, source, item)
event:FireClient(player, source, item)
end)
Receiver Script (Local Script)
TweenService = game:GetService("TweenService")
RunService = game:GetService("RunService")
counter = 0
event = game.ReplicatedStorage.PreviewRequest
event.OnClientEvent:Connect(function(source, object)
print(source, object)
item = object
end)
camera = Instance.new("Camera")
camera.Parent = script.Parent
camera.CFrame = CFrame.new(Vector3.new(-5, 2, 5), item.Position)
script.Parent.CurrentCamera = camera
local radius = 5
local center = item.Position
local rad, cos, sin = math.rad, math.cos, math.sin
local totalTime = 50
while true do
counter = counter + 1
camera.CFrame = CFrame.new(Vector3.new(center.X + radius*cos(rad(counter%1440)), 2, center.Z +
radius*sin(rad(counter%1440))), Vector3.new())
RunService["Heartbeat"]:Wait()
end
Relevant console output
TeamTabyGamez nil Apple (Server)
nil nil (Client)