So I am making a Minigame and I want a text lable to change at the top of the screen using remote events and also going through the PlayerGui.
MAIN SCRIPT: I am using OnServerEvent would that be correct?
local maps = Repstore.Maps:GetChildren() ---------- --Events-- ---------- local Rep = game:GetService("ReplicatedStorage") local remote = Rep:WaitForChild("MainT") remote.OnServerEvent:Connect(function() end) while true do if game.Players.NumPlayers > 1 then for i, v in pairs(game.Players:GetChildren()) do local pgui = v:WaitForChild("PlayerGui") pgui:WaitForChild("MainText").TextLabel.Text = "Not enough players to start!" end else wait(2) for i, v in pairs(game.Players:GetChildren()) do local pgui1 = v:WaitForChild("PlayerGui") pgui1:WaitForChild("MainText").TextLabel.Text = "Chosing map" wait(3) ranGame = math.random(1, #maps) gameChosen = maps[ranGame] for i, v in pairs(game.Players:GetChildren()) do local pgui2 = v:WaitForChild("PlayerGui") pgui2:WaitForChild("MainText").TextLabel.Text = "Map chosen: ".. gameChosen.Name wait(3) gameChosenClone = gameChosen:Clone() gameChosenClone.Parent = game.Workspace.MapSelected wait(3) spawns = gameChosenClone.Spawns:GetChildren() for i,v in pairs(game.Players:GetPlayers())do name = v.Name check = game.Workspace:FindFirstChild(name) if check then checkHumanoid = check:FindFirstChild("Humanoid") if checkHumanoid then check:MoveTo(spawns[i].Position) end end end end end for i, v in pairs(game.Players:GetChildren()) do for i = 3, 1, 1 do local pgui3 = v:WaitForChild("PlayerGui") pgui3:WaitForChild("MainText").TextLabel.Text = "Game begins in".. i wait(1) end for i, v in pairs(game.Players:GetChildren()) do for i = 10,1, -1 do local pgui4 = v:WaitForChild("PlayerGui") pgui4:WaitForChild("MainText").TextLabel.Text = "Time left ".. i wait(1) end end end for i, v in pairs(game.Players:GetChildren()) do local pgui5 = v:WaitForChild("PlayerGui") pgui5:WaitForChild("MainText").TextLabel.Text = "Game ended" wait(3) for i, v in pairs(game.Players:GetChildren()) do local pgui6 = v:WaitForChild("PlayerGui") pgui6:WaitForChild("MainText").TextLabel.Text = "Giving the win to players who won!" for i, v in pairs(game.Players:GetPlayers()) do inGame = v:FindFirstChild("InGame") if inGame then v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1 v.leaderstats.Coins.Value = v.leaderstats.Coins.Value + 50 end end end gameChosenClone:Destroy() for i,v in pairs(game.Players:GetPlayers())do v:FindFirstChild("Humanoid").Health = 0 end for i, v in pairs(game.Players:GetChildren()) do for i = 60,1, -1 do local pgui4 = v:WaitForChild("PlayerGui") pgui4:WaitForChild("MainText").TextLabel.Text = "Intermission ".. i wait(1) end end end end wait(1) end
LOCAL SCRIPT: Should I use FireServer? or somthing else? OR Should i do remote.FireServer()
local Rep = game:GetService("ReplicatedStorage") local remote = Rep:WaitForChild("MainT") ---------- --Player-- ---------- player = game.Players.LocalPlayer remote:FireServer()