repeat wait(25) for i, v in pairs(game.Teams.Runners:GetPlayers())do v.Player.PlayerGui.RewardGui.Background.Visible = true wait(189) end until false
This script will get players in runners team and will make a reward gui visible Dont Works? Maybe can you say how to acess a PlayerGui.
You can't really use PlayerGui, however, you can use RemoteEvents to communicate between the server and client.
Insert a RemoteEvent in game.ReplicatedStorage and name it ShowRewardGui. Let's get onto using the Remote
Insert a LocalScript in StarterGui.
--\\ Services local repStorage = game:GetService("ReplicatedStorage") local players = game:GetService("Players") --\\ Network Data local showReward = repStorage:WaitForChild("ShowRewardGui") --\\ Player Components local player = players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local rewardGui = playerGui:WaitForChild("RewardGui") local rewardBackground = rewardGui:WaitForChild("Background") -- We are sending a request from the client to server using OnClientEvent showReward.OnClientEvent:Connect(function() rewardBackground.Visible = true end)
Your code now has to change because of our change. New Code:
--\\ Services local teams = game:GetService("Teams") local repStorage = game:GetService("ReplicatedStorage") --\\ Network Data local showReward = repStorage:WaitForChild("ShowRewardGui") --\\ Teams local runnersTeam = teams:WaitForChild("Runners") --\\ repeat <code> until false is the same thing as a while loop while true do wait(25) -- Put an _ for the index in the for loop because we are not using it for _, teamPlayer in pairs(runnersTeam:GetPlayers()) do -- This is how we communicate between client and server showReward:FireClient(teamPlayer) wait(189) end end
Hopefully this has helped you