Answered by
4 years ago Edited 4 years ago
So, the first thing we need to determine is if the chat command is set up and hooked to the client properly. Seeing as how I know a little about how your game works already, I think I'll be able to help the most.
The :start
command is handled on the server. You need to fire the client using RemoteEvents when the :start command actually does something. You can technically do this on the client's side, but since you already have a script that checks if the speaker is an admin or not on the server, using a RemoteEvent with :FireAllClients() will be best
Now, lets set some things up. You'll have to create a new LocalScript in StartScreen and delete the scripts in both the logo ImageLabels. Handling this in one script is much more convenient for our use case.
1 - Create a RemoteEvent in game.ReplicatedStorage
and name it "StartingGuiEvent"
2 - In the place where the :start
command is, you'll have to put this code in
1 | local ClientStartingGuiEvent = game:GetService( "ReplicatedStorage" ):WaitForCild( "StartingGuiEvent" ) |
2 | ClientStartingGuiEvent:FireAllClients(workspace.HomeTeam.Value, workspace.AwayTeam.Value) |
3 - And now we have to receive that RemoteEvent fire in the client. This will be in the LocalScript you created that is inside of StartScreen
01 | local StartScreenGui = script.Parent |
02 | local RightLogoFrame = StartScreenGui.Frame.RightLogo |
03 | local LeftLogoFrame = StartScreenGui.LeftLogo |
05 | local function UpdateTheVersusGui(HomeTeam, AwayTeam) |
06 | print ( "Client - Updating the versus gui" ) |
07 | HomeTeam = (HomeTeam) or (workspace.HomeTeam.Value) |
08 | AwayTeam = (AwayTeam) or (workspace.AwayTeam.Value) |
09 | if ( not HomeTeam) then |
12 | until (workspace.HomeTeam.Value) |
13 | HomeTeam = (workspace.HomeTeam.Value) |
15 | if ( not AwayTeam) then |
18 | until (workspace.AwayTeam.Value) |
19 | AwayTeam = (workspace.AwayTeam.Value) |
21 | print ( "Client - Both teams have been set, updating the GUI now" ) |
22 | RightLogoFrame.Logo.Image = HomeTeam.Logo.Decal.Texture |
23 | LeftLogoFrame.Logo.Image = AwayTeam.Logo.Decal.Texture |
24 | RightLogoFrame.BackgroundColor 3 = HomeTeam.TeamColor.Color |
25 | LeftLogoFrame.BackgroundColor 3 = AwayTeam.TeamColor.Color |
29 | game:GetService( "ReplicatedStorage" ):WaitForCild( "StartingGuiEvent" ).OnClientEvent:Connect(UpdateTheVersusGui) |
4 - Test it! I didn't use the method of finding the BoolValue
objects in the Team
objects, but I think this way will work because you are setting workspace.HomeTeam.Value to the home team anyway (as well as the away team).