You’d have to show the server code to determine the problem. The events just give the server a message that the player attempted to purchase an item, and then the server checks and lets them buy or not buy it.
anyways this mostly relies with the remotes themselves
can tell you is to change all the remotes into one remote that from client will get the weapon id / weapon name.
the issue here might be with item.Value but idk personally. oh also you do raigamount.Value which is the leaderstat value meaning it probably loops like crazy while thinking you have enough amount of raig
also try to debug your code with more prints
and also THATS IT IM HEADING STRAIGHT FOR THE CORE
You can use the Players service to find the amount of players in the server, and then use that number to create that system.
local Players = game:GetService("Players")
print(#Players:GetPlayers())
-- '#' will return a number, otherwise, it will return a table containing every player in the server
You can learn more about the :GetPlayers() method here:
Honestly I think I need to change it to :FireClient() but I can’t do that in a local script. The reason I think that is I had another post about remote events and someone said that :FireServer() sends information from a client to server.
:FireServer() is the correct way to send data from client to server
:FireClient() is used to send data from server to client
Everything looks correct with how the event is handled, try adding a debounce to prevent the function from being fired multiple times in a short time-period
Really not sure then. Just wanted to add as a suggestion that any purchase checks should be handled by the Server. If a hacker wanted to they could just spam those :FireServer() events to get the items and the Server would just give it to them.
since now i have more knowledge on remote events and bindable events and such, im going to try using that to remake or fix this bug (sorry for bumping just wanted to finish this post)
i probably needed to use bindable events instead of remote events basically