Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make specific characters get specific tools?

Hello. You may remember me from the MeshPart problem. I fixed it but I have another problem. I made a character select GUI. It uses StarterCharacters. How do I make a character have their own tools? (e.g. Scientists have a keycard) I thought about trying putting the tool into the Character's model but that has a low chance. Edit: Ok so many of you guys thought the question made absolutely 0 sense, and i am here to explain it. I have a folder in ReplicatedStorage with the Characters. I also have an GUI that allows you to select a character. So, everything works fine, and I choose the Scientist for example. I want players who choose that character get a keycard.

1 answer

✓ Accepted answer

Do an library of the character's name and his repsective tools.

Your explanation has no script and it's difficult to write a code with no reference, so I'll try my best:

local tools = {
  ["Scientist"] = "keycard"
  ["Teacher"] = "book"
  ["Assasin"] = "knife"
  ["Sherrif"] = "gun"
}

I made a library, then you have to check the name and its respective key (tool) and add to the chararacter you want.

local char = game.Workspace.Char -- An example character - -

local tools = {
  ["Scientist"] = "keycard"
  ["Teacher"] = "book"
  ["Assasin"] = "knife"
  ["Sherrif"] = "gun"
}

if tools[char] then
      local tool = tools[char]
      print(char.Name .. " uses a " .. tool) -- Example of what you can do with  the tool
end

3 comments

0

tools[char.Name]

0

but even then you shouldnt rely on the character name, because it can be changed. you should use :GetPlayerFromCharacter() for an absolute

0

Yes I know but the question is confusing

This discussion is preserved as it was. New answers, comments, and votes are closed.