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

How to give tools to certain players?

Asked by 10 years ago

I want to make it is like one person has a knife, another a gun, etc. Kind of like Murder Mystery.

3 answers

Log in to vote
0
Answered by 10 years ago

You can do a function that will start the game if there are enough player to play the game, from there you can call 2 different variables:

"murderer" and "policeman", at both will be assigned a random player from the players connected to the server, after that you can create a StringValue and put as a value the variable got from the random player chose.

FOR THIS YOU CAN USE A STRINGVALUE STORED IN THE PLAYER!

From that you can check what is the role given to the player and then giving him the tools:

function check()
    -- Your starting game code and random selection of the murderer and the policeman
    for _, player in pairs (game.Players:GetChildren()) do
        local team = player:FindFirstChild("Team")
        if team.Value == "murderer" then
            game.Lighting.YourMurdererTool:().Parent = player.Backpack
        elseif team.Value == "policeman" then
            game.Lighting.YourPolicemanTool:Clone().Parent = player.Backpack
        else
            print("Nothing for you, innocent =)!")
        end
    end
end
Ad
Log in to vote
-1
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

First off, why'd you put "certain"? In Murder Mystery, the roles are given to random people. Not specific people. Also, this isn't a "we do it for you" site.

Tips to get started:

  1. Use math.random
  2. Use the Wiki
  3. Don't ask people to do it for you. It's better to learn from your own experience.
  4. When you created a script, come to us so we can debug it.
Log in to vote
-2
Answered by
yurhomi10 192
10 years ago

you'll have to define both innocent and murderer. Also the player, not so hard really.

tool = game.Lighting.Tool
if player == innocent then
print("nothing for you")
elseif player == murderer then
tool.Parent = murderer.BackPack
end


0
You never defined ANY of the variables.. Shawnyg 4330 — 10y
0
thast because HE hase to define them, i'm not doing any of his work. yurhomi10 192 — 10y

Answer this question