Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a script like no tools will be duplicated?

Asked by 6 years ago

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
0
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. Viking359 161 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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 ;)

0
You also need to check the player module too. hiimgoodpack 2009 — 6y
Ad

Answer this question