It needs to find all the players so it can change the Properties of a PlayerGui. Here's my script:
script.Parent.MouseButton1Click:Connect(function() local Slot = script.Parent.Parent.Parent.Parent:GetChildren()[math.random(1,#script.Parent.Parent.Parent.Parent:GetChildren())] if Slot.Name == "Slot1" then if Slot.Visible == false then script.Parent.Parent.Visible = false local players = game.Players:GetChildren() for i = 1,#players do game.Players[i].PlayerGui.MainGui.Missions[Slot.Name].Visible = true game.Players[i].PlayerGui.MainGui.Missions[Slot.Name].Difficulty.Text = script.Parent.Parent.Vals.Difficulty.Value game.Players[i].PlayerGui.MainGui.Missions[Slot.Name].Host.Text = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name game.Players[i].PlayerGui.MainGui.Missions[Slot.Name].Mission.Text = script.Parent.Parent.Vals.Mission.Value game.Players[i].PlayerGui.MainGui.Missions[Slot.Name].Players.Text = "Players: 1/4" game.Players[i].PlayerGui.MainGui.Missions[Slot.Name].Host.HostName.Value = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name game.StarterGui.MainGui.Missions[Slot.Name].Visible = true game.StarterGui.MainGui.Missions[Slot.Name].Difficulty.Text = script.Parent.Parent.Vals.Difficulty.Value game.StarterGui.MainGui.Missions[Slot.Name].Host.Text = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name game.StarterGui.MainGui.Missions[Slot.Name].Mission.Text = script.Parent.Parent.Vals.Mission.Value game.StarterGui.MainGui.Missions[Slot.Name].Players.Text = "Players: 1/4" game.StarterGui.MainGui.Missions[Slot.Name].Host.HostName.Value = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name end else script.Parent.Text = "Error Occured! Try again!" wait(2) script.Parent.Text = "Ready!" end else script.Parent.Text = "Error Occured! Try again!" wait(2) script.Parent.Text = "Ready!" end end)
Anything wrong with it?
when you do game.Players[i]
, it's interpreted as you literally trying to get a property or child that's named 1 (not a string, but a number)
what you should be doing instead is game.Players:GetPlayers()[i]
or in your case, since you already got the players, players[i]