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?
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.
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?