I recently created an inventory of swords, which makes me worry that Exploits can clone a tool saved within the player. How this system works:
The player purchases an item, and the client sends it to a Remote (Server), which checks to see if the player has the money, and if he doesn’t have the item. If the player has the money but doesn’t have the item, the item will be added to his inventory, saving it.
After saving, the item will be saved in a folder called “OwnedSwords”, inside the player in Tool format. And the saved item will be cloned with scripts inside the player folder.
My concern is whether a player who uses cheats can clone this item into their inventory to use.
I’m sorry if my English is bad, English is not my main language.
I appreciate any help.
This could happen BUT, im assuming that the script(s) in the sword is or are either: Client and Server or only Server. The case with both is: if the exploiter tries to clone it, it goes to their inventory but they cannot use it. I’ve tested this myself with a tool that has a Client script and a Server script, and it only did the things that the client does, it affected nothing of the server world. Conclusion:
Yes, but the tool won’t work.
Hmm, interesting. I was thinking of a different method, the inventory Script will clone the purchased Swords to the player’s folder, and erase the Sword’s Scripts inside, and leave only the Module, which the game uses to identify the equipped item.
Thanks for the reply. I’ll come back later and give you some updates.
Oh, my games are inactive because I was away from Roblox Studio for a few months. Also, I was making a total change to the game, so for now it’s just testing.
Could you send me a friend request later? I’ll open it for you to test.
-- This script should be placed on the ServerScriptService or the tool store logic
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
-- Define the tool you are selling (you could get this from the tool store)
local toolTemplate = game.ServerStorage.ToolTemplate -- This is your tool template
-- Event for buying a tool (you could trigger this from a RemoteEvent)
local buyToolEvent = ReplicatedStorage:WaitForChild("BuyToolEvent")
-- Function to check if the player already owns the tool
local function playerOwnsTool(player, toolName)
for _, tool in ipairs(player.Backpack:GetChildren()) do
if tool:IsA("Tool") and tool.Name == toolName then
return true
end
end
return false
end
-- Handling the buy tool event
buyToolEvent.OnServerEvent:Connect(function(player, toolName)
-- Check if the player already owns the tool
if playerOwnsTool(player, toolName) then
-- Inform the player that they already own the tool
print(player.Name .. " you already have the tool!")
return
end
-- If the player doesn't own the tool, give it to them
local newTool = toolTemplate:Clone()
newTool.Name = toolName
newTool.Parent = player.Backpack
end)
This will prevent them from being able to purchase the same tool
Make sure it also checks that whoever sent the remote is a real player in the game. Also, make the Sword of Unlimited Power, unseen in the game; it is a trap, and on the spots yields a lifetime ban.