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

How to make a constantly looping script? How to make one fire when someone joins the server? [closed]

Asked by 9 years ago

How would one make a script that constantly loops? How about making a script that runs specific to any player that just joins the server?

Closed as Not Constructive by YellowoTide and woodengop

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
0
Answered by
pwnd64 106
9 years ago

To make a constant loop you'd use "while true do", like this -

while true do
wait(.1)
--do thing here
end

Remember to put a wait! If you don't, when you run the script it will run the script infinitely fast an infinite amount of times, which will crash your client!

To make a script that fires for a certain player, you would do -

game.Players.PlayerAdded:connect(function(player)

"player" represents the player who joined, so for example if I want to make a bool value specific to a player (for example for an inventory system) I would do -

game.Players.PlayerAdded:connect(function(player)
local bool = Instance.new("BoolValue")
bool.Name = "ExampleBool"
bool.Parent = player

This would make a bool that is inside the player, and would do that for everyone who joins the game.

Tell me if you need anything else.

0
why do people keep answering requests drew1017 330 — 9y
Ad