I don't understand why its not working, trying to make it pick a random player from Players and making the Value "Asking" true
local QuestionParts = game.Workspace.QuestionParts local TotallyNotRemotes = game.ReplicatedStorage.TotallyNotRemotes local AskGui = game.Lighting local ServerGui = game.Lighting game.Players.PlayerAdded:connect(function(player) function chooserandom() local players = game.Players:GetChilderen() print (#players) if #players > 2 then local RandomPlayer = players[math.random(1,#players)] RandomPlayer.Asking.Value = true chooserandom() end end end)
How exactly are you figuring this will work? You are calling "chooserandom" inside the function "chooserandom". Your code should be like this. Just eddited the structure a bit.
local QuestionParts = game.Workspace.QuestionParts local TotallyNotRemotes = game.ReplicatedStorage.TotallyNotRemotes local AskGui = game.Lighting local ServerGui = game.Lighting function chooserandom() local players = game.Players:GetChilderen() print (#players) if #players > 2 then local RandomPlayer = players[math.random(1,#players)] RandomPlayer.Asking.Value = true end end game.Players.PlayerAdded:connect(function() chooserandom() end)