Answered by
6 years ago Edited 6 years ago
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
:
01 | local lv 1 = game.ReplicatedStorage:FindFirstChild( " " ) |
02 | local lv 2 = game.ReplicatedStorage:FindFirstChild( " " ) |
04 | lv 2. Changed:Connect( function (property) |
05 | if lv 2. Value = false then |
For Server-Side Scripts
:
01 | local sv 1 = game.ServerStorage:FindFirstChild( " " ) |
02 | local sv 2 = game.ServerStorage:FindFirstChild( " " ) |
04 | sv 2. Changed:Connect( function (property) |
05 | if sv 2. Value = false then |