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

How do I choose a specific player?

Asked by 6 years ago
Edited 6 years ago

I am trying to create a minigame sort of thing, so I want all players to start in the lobby, wait a certain amount of time and then be teleported to a randomly chosen map, but I want one specific player chosen at random to be turned invisable, if the smoke particle on their torso and then have it so that anyone they touch dies. Once a player who is not the one with the smoke particles touches a specific block it will display that that player won and then teleport everyone back to the lobby and start over.

If that makes any sense. So this is what I have so far, I am still learning so bare with me.

while true do
 wait(5)
 m = Instance.new("Message") 
 local players = game.Players:GetChildren() 
 local num = math.random(1,1) 
 if num == 1 then
  m.Parent = game.Workspace 
  m.Text = "Choosing Map..." 
  wait(4)
  m.Text = "Map Number " ..num.. " Was Chosen"
  wait(3)
  m.Text = "[MAP NAME]; Maker: [MAP MAKER NAME]"
  wait(3)
  m.Text = "You Have 3 Minutes."
  wait(3)
  m.Parent = nil
  game.Lighting.Map1:clone().Parent = game.Workspace 
  for i = 1, # players do
   players[i].Character:MoveTo(Vector3.new(57.81, 0.5, 31.09)) 
  end
  wait(5)
  game.Workspace.Map1:Remove() .
  m.Parent = game.Workspace
  m.Text = "Game over! Thank you for playing!"
  wait(3)
  m.Text = "You have 1 minute until the start of the next game."
  wait(3)
  m.Parent = nil
 end
 m:Remove()
end

Any help will be greatly appreciated thanks :)

2 answers

Log in to vote
1
Answered by
xEiffel 280 Moderation Voter
6 years ago

I think this is what you mean, You'll have to do the particle part which is listed in the script in the :GetChildren() Part, If you don't understand how to do the particle part I can do it if you like, (Just comment), I have listed what I have added/changed in the script in '--' just giving information on some of the events being triggered; nonetheless, here is the script.

local Transparency_Amount = .7 -- Change this to how transparent you want the bodyparts.

local function Restart(m) -- Made this into a function (m) means the Message.
 game.Workspace.Map1:Remove() .
  m.Parent = game.Workspace
  m.Text = "Game over! Thank you for playing!"
  wait(3)
  m.Text = "You have 1 minute until the start of the next game."
  wait(3)
  m.Parent = nil
 m:Remove()
end

while true do
 wait(5)
 m = Instance.new("Message") 
 local players = game.Players:GetChildren() 
 local num = math.random(1,1) 
 if num == 1 then
  m.Parent = game.Workspace 
  m.Text = "Choosing Map..." 
  wait(4)
  m.Text = "Map Number " ..num.. " Was Chosen"
  wait(3)
  m.Text = "[MAP NAME]; Maker: [MAP MAKER NAME]"
  wait(3)
  m.Text = "You Have 3 Minutes."
  wait(3)
  m.Parent = nil
  game.Lighting.Map1:clone().Parent = game.Workspace 
  for i = 1, # players do
   players[i].Character:MoveTo(Vector3.new(57.81, 0.5, 31.09)) 
  end
  local ArbitraryPlayer = players[math.random(#players)] -- Chooses an arbitrary {Random} player
  if workspace:FindFirstChild(ArbitraryPlayer.Name) then -- If the player isn't nil
  for _, Items in pairs(workspace:FindFirstChild(ArbitraryPlayer.Name):GetChildren()) do
  if Items:IsA("BasePart") then -- So it gets a objects that has the objects of a normal Part.
  Items.Transparency = Transparency_Amount -- The transparency of the players bodyparts
--[[ Here you should be inserting the particles you want and cloning it into (workspace:FindFirstChild(ArbitraryPlayer.Name).HumanoidRootPart) --]]
  end
  end
  end
  workspace.Map1.--[[BLOCK NAME THAT WILL TRIGGER IF TOUCHED--]].Touched:Connect(function(Hit)
  if Hit.Parent.Name ~= ArbitraryPlayer.Name then
  Restart(m)
  end
  end
 end
end

Hope this helped, feel free to ask questions!

0
You are so helpful thank you! I want the particles to be the smoke particle but it needs to be lime green is that possible? And I should have elaborated, but after 3 or have ever many minutes goes by, I'd like the game to end and teleport everyone back to the lobby, if however everyone but the person who has the particle effect dies the game will end, everyone will be teleported to the lobby and Pot8o_Penguin 50 — 6y
0
Get the message "The killer one played by [insert user who had the particles]", but if someone touches the block everyone gets teleported back to the lobby and the gets the message "[Insert person who touched the block] won" Pot8o_Penguin 50 — 6y
0
Alright I'll attempt at my best! xEiffel 280 — 6y
0
Sorry my internet went down before I could finish my comments sorry if those previous two came off as demanding. Back to what I was saying before my service provider so rudely interrupted me, is there a way to have it so that you can buy a gamepass and it will change the colour of you smoke effect when you're the killer? And if you own multiple of the game passes it will randomly select one for Pot8o_Penguin 50 — 6y
View all comments (11 more)
0
for you to be? If that makes any sense. I was also just wondering if you could explain to me which part of the script makes it so that the player with the particles or the killer, when the touch someone they die? Thanks for explaining the rest of the script also, cause some people just give me the script and I don't know how it works, so I appreciate you doing that, so I can learn more. Pot8o_Penguin 50 — 6y
0
Sorry for all the questions, thanks for all he help again :) Pot8o_Penguin 50 — 6y
0
I mean when the killer touches someone, that someone they touched dies, not the killer themselves. Sorry Pot8o_Penguin 50 — 6y
0
Okay. xEiffel 280 — 6y
0
I'm really sorry to be so annoying and pestering, but this is something that's actually needed for the game to work, is the killer able to radiate some light? Sorry again for adding onto to load. Pot8o_Penguin 50 — 6y
0
I have come to a realisation, I need two killer, because one would be to hard for the killers to win. If you no longer want to help me with this I understand as I totally get if you find me annoying with all the requests. Pot8o_Penguin 50 — 6y
0
Sorry I keep forgetting about certain details, I promise I'm not trying to add to your load, if you don't have to do the gamepass thing, in fact you don't have to do any of this if it's to annoying for you. However if you do decide to continue, the killer all need a sound to be raidiating from him/her, so when he's close people can hear him and the sound fade when he walks away. The killer also ne Pot8o_Penguin 50 — 6y
0
The killer also needs to be a little faster than the average walk speed. I am going to put your name in the credits of the game if that's alright with you, because you have still helped a lot. Pot8o_Penguin 50 — 6y
0
Okay, I'll attempt to get some of it done. xEiffel 280 — 6y
0
Gee, thank you so much :) Pot8o_Penguin 50 — 6y
0
Hey, just wondering how the script is coming along? Pot8o_Penguin 50 — 6y
Ad
Log in to vote
1
Answered by 6 years ago

I hope this code will help. It use :GetPlayers() and then pick a random player from the table that it makes. So it makes it random, I would recommend having it spawn everyone to the map then pick the Killer and spawn him to his spot. It less complex because if you spawn him first you will need make code that will need make him not spawn with the others. So by spawning him with the players then spawning him again to his spot it make it more easy to spawn him and the other people who playing.

function Killer_Pick()
    print('Picking MadTrapper')
    local randomPlayer = game.Players:GetPlayers()
    local Killer = math.random(1,#game.Players:GetPlayers())
    -- Do what ever make him invisible here and spawn him
end

Answer this question