How could I make this work?

So i’m making an rng game, I need to get a certain value (aka the rarity), and i’m getting it through a remote event. Here is the client script:

local newRarity
game.ReplicatedStorage.Remotes.Rarity.OnClientEvent:Connect(function(player, rarity)
	newRarity = rarity
	print(rarity)
end)

Here is the other script:

	local rarity = rarity1 * rarity2
	game.ReplicatedStorage.Remotes:WaitForChild("Rarity"):FireClient(player, "Test")

Any ideas? And if you know why, can you give me an alternitive?

1 Like

the client script remote listener does not take player as the first parameter by default

local newRarity
game.ReplicatedStorage.Remotes.Rarity.OnClientEvent:Connect(function(rarity)
	newRarity = rarity
	print(rarity)
end)
1 Like

Remove the player variable in the OnClientEvent.

game.ReplicatedStorage.Remotes:WaitForChild(“Rarity”):FireClient(player, “Test”)
Should be:
game.ReplicatedStorage.Remotes:WaitForChild(“Rarity”):FireServer(rarity)
On the local script

1 Like

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