Remote event not working

I’m making a game where I need a remote event to show that the players bag is full.

game.ReplicatedStorage.Remotes.PackFull:FireClient(plr)
						print("fired")

This is the server script that sends the remote to a local script
It prints “fired” but dosent actually work.

game.ReplicatedStorage.Remotes.PackFull.OnClientEvent:Connect(function()
	print("e")
	script.Parent.Frame:TweenPosition(UDim2.new(0.3, 0,0.6, 0),Enum.EasingDirection.In,Enum.EasingStyle.Circular,0.5)
end)

This is the script receiving it.
It doesn’t print “e”
It seems pretty simple and I cant find out why it wont work.

1 Like

Your syntax is wrong, FireClient is a function not an event, unless if this end was some error made during copying the script to the post.

Take out the end.

						game.ReplicatedStorage.Remotes.PackFull:FireClient(plr)
						print("fired")

Sorry, there wasn’t suppose to be an end.
There was an if statement above the code I showed.
This is the correct code.

Are you getting any output errors? Can you confirm that your LocalScript is running by putting a print on the first line?

Simple error. Your local script should be in StarterPlayerScripts not anywhere else.

local BoomBux = game.Players.LocalPlayer.leaderstats.BoomBux
local text = script.Parent.Frame
local packs = game.Players.LocalPlayer.leaderstats.BackPacks:GetChildren()
for i,backpacks in pairs(packs) do
	while wait(0.1) do
	if backpacks.Purchased.Value == true then
		if backpacks.Equipt.Value == true then
			local currentpack = backpacks
				text.Text = BoomBux.Value .. "/" .. backpacks.Storage.Value
			end

		end
	end



end

game.ReplicatedStorage.Remotes.PackFull.OnClientEvent:Connect(function()
	print("e")
	script.Parent.Frame:TweenPosition(UDim2.new(0.3, 0,0.6, 0),Enum.EasingDirection.In,Enum.EasingStyle.Circular,0.5)
end)

I cant put it in the StarterPlayerScripts because of

local text = script.Parent.Frame

I also get this error when it is in StarterPlayerScripts
image

I put a print on the first line and it was running.
I’m not getting any errors

Try using a WaitForChild on leaderstats.

local packs = game.Players.LocalPlayer:WaitForChild("leaderstats"):WaitForChild("BackPacks"):GetChildren()

Also, @Voliiqs is right that it needs to be in a specific place where LocalScripts run. LocalScripts only work in certain locations as of a update a while back.

It simply would not work. You can not access the server from local scripts. You need to use a server script in server script storage for this.

Do objects inside of a Player not replicate? I haven’t personally tested this.

I haven’t done this much myself either. However, I do know for a fact that you can not access the player leaderboard from a local script. A leaderboard is server oriented.

1 Like

Of course it’s meant to be Server oriented. You couldn’t edit the value of the IntValue on anything but your own client, but can you view the values that are replicated from the server? I will test this out later.

The remote function you suggested is a good solution regardless.

I will rewrite my script to fit your reply.

That’s a good idea. If your trying to use an event you quite literally have to do this. Make sure its in starter play scripts as well.