EDIT: I HATE ADS!!!!!!!!
You might have to put everything into two or more scripts, because it just won't work in one (well, it might). It is a little messy. I say instead of using Events or RemoteEvents, use Values and the .changed function trigger. Like so:
This is for something like a rounds game with two teams:
Import these lines of code in the Command Prompt (Note that you can do any value type or name you want):
local sValue = Instance.new("BoolValue", game.ServerStorage) -- This is the Value for Server-Side scripts to access.
sValue.Name = "Team1Won"
local lValue = Instance.new("BoolValue", game.ReplicatedStorage) -- This is the value for Client-Side Scripts to access.
lValue.Name = "Team1Won"
local sValue2 = Instance.new("BoolValue", game.ServerStorage) -- This is the Value for Server-Side scripts to access.
sValue.Name = "GameInProgress"
local lValue2 = Instance.new("BoolValue", game.ReplicatedStorage) -- This is the value for Client-Side Scripts to access.
lValue.Name = "GameInProgress"
Whenever you want to say that "Team 1 won the game!", you can just set this value to true.
However, we need to do something about the fact that team 1 won/lost.
Inside the player's GUI, (via StarterGUI) we need to make changes. You can add whatever suits you from here, or change the scripts to your needs.
For Client-Side Scripts :
local lv1 = game.ReplicatedStorage:FindFirstChild(" ")
local lv2 = game.ReplicatedStorage:FindFirstChild(" ")
lv2.Changed:Connect(function(property)
if lv2.Value = false then
if lv1 = true then
end
if lv2 = true then
end
end
end)
For Server-Side Scripts :
local sv1 = game.ServerStorage:FindFirstChild(" ")
local sv2 = game.ServerStorage:FindFirstChild(" ")
sv2.Changed:Connect(function(property)
if sv2.Value = false then
if sv1 = true then
end
if sv2 = true then
end
end
end)
7 comments
If I am not wrong you cant access players GUI through server script. So I think you have to use remotes
incorrect.
If incorrect how would I do it?
not you, the first commenter
And how is it incorrect?
You can do your tricks to check when potential remote can be fired but you cant access players gui via server script.
Still i dont see why would you use the values instead of remotes since with the values it ill be even messier.