How to make a script like no tools will be duplicated on a player? Like if he have the tool "Building Tools" the player can't have another one if:
- the player clicked on the tool giver or
- the player was given by admin command
How to make a script like no tools will be duplicated on a player? Like if he have the tool "Building Tools" the player can't have another one if:
You could add code into the giver script that checks if the player has the tool in this backpack and if not then give it too him.
local good = true
local tool = (tool am trying to give)
local player = (the player you got from the admin/give)
local tools = Player.Backpack:GetChildren ()
For i=1,#tools do
If tools[i].Name == tool.Name then
Good = false
end
end
If good == true then
--give tool
end
and if you have the character not the player you can get the player with the code:
local character = (character you got from script)
local player = game.Players:GetPlayerFromCharacter(character)
Hope that helps ;)
You also need to check the player module too.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
have it check the player's backpack or starter pack and if it's there end the function, if it isn't continue the fiunction.