I have a script that chooses a random player, but I don't understand how to give that random player a weapon. Any help would be appreciated :D
wait(10)
dft = {}
local plrs = #game:GetService('Players'):GetChildren()
function GetPlayers()
local c = game.Players:GetChildren()
for i = 1, #c do
table.insert(dft, c[i].Name)
end
end
if plrs >= 2 then
function Randomize()
GetPlayers()
local d = math.random(1, #dft)
local s = d
local m = Instance.new("Message", game.Workspace)
m.Text = "The random player is ... "..dft[s].."!"
wait(2)
m:Remove()
local rndm = game.Players:FindFirstChild(dft[s])
if (rndm ~= nil) then
local Player = rndm.Character
Player:MoveTo(Vector3.new(6, 13, 49))
end
end
while wait(20) do
print("Done waiting.")
print("Randomizing.")
Randomize()
break
end
else
local h = Instance.new("Message")
h.Parent = workspace
h.Text = "Not enough players."
wait(10)
h:Remove()
end
plrs = #game:GetService('Players'):GetChildren()

1 comment
Sorry but you're code isn't good, I already answered a way better code