so i need a script and I can't find it anywhere. And I am noob at writing script so i can't write it. Does anyone have this script?
(ex. if player 1 has a tool name 'sword' , then he can't get it anymore.)
https://scriptinghelpers.org/questions/109392/how-to-limit-1-of-each-tool-in-a-players-backpack
this post should answer that
imma assume that when a player touch a brick, the game gives them a sword
local Sword = game.ServerStorage.Sword --- or where ever the sword tool is stored local SwordString = tostring(Sword) script.Parent.Touched:Connect(function(player) -----This script must be in the part which is desired to give the sword local backpack = game.Players[player.Name]:WaitForChild("Backpack") if backpack:FindFirstChild(SwordString) then --- checking for sword in the player print("player already has item") --- code that fire if there is already a sword else local SwordCopy = Sword:Clone() --- if there isn't a sword, copy the original SwordCopy.Parent = backpack --- set the parent of the sword to the player's backpack end )
If you need anymore questions, reply to this
It's pretty simple. When you give them the sword, you make a check inside their backpack to see if that item already exists. You could do something like this:
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- Now we will first check if they already own the item. if not player.Backpack:FindFirstChild("ItemNameHere") then ItemName:Clone().Parent = player.Backpack end end end)
Hope it helped.
Closed as Not Constructive by imKirda, Soban06, and WizyTheNinja
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?