Hi,
So I made a shop where you can buy tools from, but when I purchase a tool, I don’t get the item. Money does go from my balance, but I receive nothing.
When the item is bought, I get this error in the output: "0 is not a valid member of Folder "ReplicatedStorage.Tools"
When I click on the error, it leads to this script in ServerScriptService:
It seems that you are passing incorrect arguments to your remote event. The “Tool” variable is set to 0 which is not a valid Instance in your Tools folder.
As @player356377 said, you are passing the number 0 as the tool, instead of a string.
And if your money management is done though a local script
(Money gets removed when player purchases something, client then tells server to give item, after removing money)
That just means exploiters can easily get the best items in the game, as you would have no server sided verification.
Check the value of your script.Parent.Tool variable and make sure that the name of the tool is correct. Regarding the issue with exploiters, check if a player has the required money and subtract it inside your Server Script. Exploiters can only modify their own client (Local side) and can not access the server.
I think you shall check or print the value before and after transforming. Sometimes Studio will accidently change the type of value, like number or string, as “0” is not the same as 0.
local Storage = game:GetService("ReplicatedStorage")
local RemoteEvent = Storage.Events.RemoteEvent
local function BoughtTool(player,ToolValue)
for i,v in pairs(Storage.Tools:GetChildren()) do
if v.Tool.Value == ToolValue then
local Tool = v:Clone()
Tool.Parent = player.Backpack
end
end
end
@madonchik123
This will not resolve the presented issue. The issue with the script is that the “Tool” variable passed is incorrect in addition to the script being vulnerable to exploits, both of which this script will not fix.