Event.FireClient() not working

The goal of my script is to unequip the sword that is equipped when another sword is being equipped. Unexpectedly when I used the FireClient() function, it sent over a nil value for the variable that was being sent to the localscript.

Serverscript

game.ReplicatedStorage.UnequipEvent.OnServerEvent:Connect(function(player, finder)
	local location = game.ServerStorage[player.Name]
	for i,v in pairs(location.Equipped:GetChildren()) do
		v.Parent = location.Unequipped
		game.ReplicatedStorage.DataStoreUsage.UnequipOthers:FireClient(player, v) -- FireClient() event
	end
	game.ServerStorage[player.Name].Unequipped[tostring(finder)].Parent = game.ServerStorage[player.Name].Equipped
end)

Localscript

game.ReplicatedStorage.DataStoreUsage.UnequipOthers.OnClientEvent:Connect(function(v)
	print(v) -- returns nil
	if v ~= nil then
		print("fired")
		if player.PlayerGui.ScreenGui.Frame.ScrollingFrame:FindFirstChild(v.Name) then
			player.PlayerGui.ScreenGui.Frame.ScrollingFrame[v.Name].Equipped = false
			print("fired normal")
		else
			print("fired sframe2")
			player.PlayerGui.ScreenGui.Frame.Sframe2[v.Name].Equipped = false
		end
	end
end)

what is v? because if its a model, or exists on the server I don’t think It can be accessed by the client

v is in fact a model… I just realized that. I will apply changes and see if they work.

you can try placing what is stored in the ‘location’ variable in replicated storage, then fire a string like the name of the model, then it can be accessed by the client

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