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

How do I make select a player script? [closed]

Asked by
Smach28 10
6 years ago

Hi, So I need a script for my game where at the beginning of each round it picks a random player to be a killer, and I don't know how to do this, can you guys pls kind of give an example or what to type on the wiki, Thanks! :D

Closed as Not Constructive by User#18043, PyccknnXakep, and hiimgoodpack

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

You need to use math.random to pick a random player.

p = game:GetService("Players"):GetChildren()
randplayer = p[math.random(1,#p)]
print(randplayer.Name)

Please accept if this helped!

0
will it save that rand player. Smach28 10 — 6y
0
This just an example. Read the wiki to find out how to do that. PyccknnXakep 1225 — 6y
0
GetPlayers() not GetChildren Filipalla 504 — 6y
0
Works too, why would you put anything else in the Players service? hiimgoodpack 2009 — 6y
Ad