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

How to give tools to certain players?

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

3 answers

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

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.

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


2 comments

0

You never defined ANY of the variables..

0

thast because HE hase to define them, i'm not doing any of his work.

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