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 put tool giving script for playerPicked?

I have tried everything, but my mind is not enough to defeat my script skills. Heres SOME of the script.

        						PlayersInGame = game.Players:GetChildren()
										for i = 1, #PlayersInGame do 
												PlayersInGame[i].Character:MoveTo(TeleportLocation + Position)
									h.Text = "Game in progress [2 Minutes]"
									playerPicked=players[math.random(1,#players)]

(Tool giving script here for playerPicked?) (Tool will be in Lightning)

2 answers

✓ Accepted answer
local Players = game.Players:GetPlayers()
local Object = 'Weapon' --Change it to ur Weapon

PickedPlayer = Players[math.random(1, #Players)]

for i, v in pairs (game.Lighting:GetChildren()) do
if v.Name == Object then
v:clone().Parent = PickedPlayer.Backpack
end
end

PickedPlayer.Character:MoveTo(Position/Part Position)
h = Instance.new('Message')
h.Text = 'Game in Progress [2 Minutes]'

Am just giving Advice on wat the Script would better look like...

This shall help c;

local PlayerGet = game.Players:GetPlayers() 
local ObjectName = "Speed Coil" --change to object in lighting

for i,v in pairs(PlayerGet) do 
	v.Character:MoveTo(TeleportLocation + Position)
end

h.Text = "Game in progress [2 Minutes]"
game.Lighting[ObjectName]:Clone().Parent = game.Players[tostring(PlayerGet[math.random(1,#PlayerGet)])].Backpack

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