Hello, I’ve already used FireClient(player)
hundreds of times.
I don’t understand why randomly or in certain scripts it doesn’t work while the other function, which is a copy and paste, does.
For example, this code
Localscript :
while task.wait(1) do
if text then
RequestSablierEx:FireServer()
text.Text = IntValue.Value
end
end
RequestSablierEx.OnClientEvent:Connect(function(RECEIVEDINT)
IntValue.Value = RECEIVEDINT
end)
Server Script :
RequestTix.OnServerEvent:Connect(function(player)
local success, int = pcall(function()
return CurrencyTix:GetAsync(player.UserId)
end)
if success and int then
RequestTix:FireClient(player, int)
end
end)
Client → Server OK
Server → Client NOT OK
Player is not nil, Int is not nil, ALL IS VALID
And this code work :
localscript :
button.Activated:Connect(function()
RequestBooster:FireServer(ID, Price)
end)
RequestBooster.OnClientEvent:Connect(function(ID, isGiven)
if isGiven then
local UIToClone = game:GetService("ReplicatedStorage").Ressource.UI.Booster.ShowBooster:Clone()
UIToClone.Parent = game:GetService("Players").LocalPlayer.PlayerGui
UIToClone.IDBooster.Value = ID
print("Booster given")
else
print("You don't have enough money!")
end
end)
Server script :
RequestBooster.OnServerEvent:Connect(function(player, ID)
local localSablier = GetSablier(player)
if localSablier >= Price then
localSablier = localSablier - Price
local success, errorMessage = pcall(function()
inventoryStore:SetAsync(player.UserId, localSablier)
end)
if not success then
warn("Erreur lors de la sauvegarde de l'inventaire pour :", player.Name, errorMessage)
else
RequestBooster:FireClient(player, ID, true)
end
else
RequestBooster:FireClient(player, ID, false)
end
end)
Client → Server OK
Server → Client OK
Player is not nil, Int is not nil, ALL IS VALID