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)