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?
COMMUNITY QUESTION
How to make a constantly looping script? How to make one fire when someone joins the server?
1 answer
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
why do people keep answering requests