RemoteEvent is not firing

Hello. I am making upgrades, using BoolValue, and when i try to fire event from a localscript, it is not firing. I put the print statement, to see, if remoteEvent is acutally firing. But it is not.

Here is the code for remoteEvent:

rsEvent.BuyEvent.OnServerEvent:Connect(function(plr, upgrade, price)
	for _, v in pairs(plr.Upgrades:GetChildren()) do
		if v.Name == upgrade then
			print("it worked!")
			PlayerDataHandler:Set(plr, upgrade, true)
			plr.leaderstats.Cash.Value -=price
		end
	end
end)

Code for firing the remoteEvent:

local frame = script.Parent
local rs = game:GetService("ReplicatedStorage")
local rsEvent = rs:WaitForChild("Events")
local player = game.Players.LocalPlayer
local cash = player:WaitForChild("leaderstats").Cash

frame.HatSection.BuyButton.Activated:Connect(function()
	if cash.Value <= 75 then
		rsEvent.BuyEvent:FireServer("HatUpgrade", 75)
	end
end)

Any help will be appreciated!

1 Like

First are you sure you need to wait for the events folder?

local rsEvent = rs:WaitForChild("Events")

Secondly, why use the Activated event for the button?

frame.HatSection.BuyButton.Activated:Connect(function()
1 Like

I have just changed from Activated event to MouseButton1Down and nothing seems to change.

For the events folder, i am pretty sure that i need to wait for it, because it is client, and from client, it is cannot load instantly.

1 Like

.Activated is compatible with all devices, there isn’t much difference but it’s a good practice.

1 Like

Shouldn’t it be greater than?

chars

probably yeah

(limit)(limit)(limit)

it worked (123 123 123 123 123)

1 Like

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