How do I send values from the server to client?

ServerScript

game.ReplicatedStorage.ItemSpawnClientEvent:FireAllClients(value)

LocalScript

game.ReplicatedStorage.ItemSpawnClientEvent.OnClientEvent:Connect(function(item)
	print(item)
end)

When i print the item on the localScript, it just returns nil

wait until the client is loaded before firing the remote ? such as adding a task.wait(1) before you fire the remote event, the server always loads before the client and if the client isn’t ready yet then it won’t get the event as it has already been fired before

What I sent was just an oversimplified version, it actually fires the client every 10 seconds (regularly it would be much longer than that but this is just for debugging so i dont have to wait)

then i dont know, what value are you sending to the client ? This could be the issue

Basically I am making a system that randomly spawns items, and I want everyone to get a gui popup saying what item spawned, so I am trying to send the name of the item from the server to the client, but on the client it just returns nil

yea but what is the value, if it is an object located on the server then that may be the reason why, if it’s string then i can’t help you but check it again

It is an object located on the server

then that is the issue try to parent it somewhere else like replicatedStorage and it should work

I parented it to replicated storage, it still returns nil

then are you sure the value is the right one?

What do you mean
ererererereerer

your “value” variable, if it’s not the right object/instance it won’t work

It is the right value
ereererererererere

Try firing the name of the item and see if it’s still nil on the client. (In the form of a string)

Try:
game:GetService(“ReplicatedStorage”):WaitForChild(“ItemSpawnClientEvent”)

I tried doing this and it actually returned the name of the item, but I can’t do this because it has to fire the client with a random value from a table

Can you print the value of the table for us? (On the server ofcourse)

Ok. Send me your full script and I might be able to help you make a workaround.

ServerScript

local items = game.ReplicatedStorage.SwordDisplays:GetChildren()
local ts = game:GetService("TweenService")
local spawns = game.Workspace.Map["Sword spawns"]:GetChildren()
local ss = game:GetService("SoundService")

while wait(10) do
	ts:Create(ss.Music, TweenInfo.new(2), {Volume = 0}):Play()
	wait(2)
	local currentTime = ss.Music.TimePosition
	ss.Music:Stop()
	ss.ItemSpawnSound:Play()
	local item = items[math.random(1,#items)]:Clone()
	local spin = script.Spin:Clone()
	spin.Parent = item
	spin.Enabled = true
	
	game.ReplicatedStorage.ItemSpawnClientEvent:FireAllClients(item)
	
	local location = spawns[math.random(1,#spawns)]
	
	task.spawn(function()
	local part = Instance.new("Part")
	part.Anchored = true
	part.CanCollide = false
	part.Shape = "Cylinder"
	part.Size = Vector3.new(1000,5,5)
	part.Orientation = Vector3.new(0,90,90)
	part.Position = location.Position
	part.Transparency = 0
	part.Material = Enum.Material.Neon
	part.Color = item:WaitForChild("Color").Value
	part.Parent = workspace
	ts:Create(part,TweenInfo.new(2), {Transparency = 0}):Play()
	wait(6)
	ts:Create(part,TweenInfo.new(2.5), {Transparency = 1}):Play()
	wait(2.5)
	part:Destroy()
	end)
	
	item.Position = location.Position
	item.Parent = workspace 
	
	wait(2)
	ss.Music.TimePosition = currentTime
	ss.Music:Play()
	ts:Create(ss.Music, TweenInfo.new(2),{Volume = 0.25}):Play()
end

LocalScript

game.ReplicatedStorage.ItemSpawnClientEvent.OnClientEvent:Connect(function(item)
	print(item)
end)

When I got the code back after deleting it, I couldn’t find the localScript so I’ll just recode it later

What do you mean by the value of the table, just what is in the table?