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 :)
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!
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