So, im making an murder mystery game, and the thing that appears on start of the round is the "show my role" gui or "show me if im murderer or innocent or sheriff" gui, and i first tried to do it in the script in the serverscriptservice because thats where my main stuff about rounds and intermission timing and stuff is located, but that didnt work, the next thing i tried was to do it with the boolvalue (i had 2 of them in my script, one for saying when the round starts and ends, and one that says to display the "show my role" gui), and that didnt work either, so a few minutes before, i tried to do it with the inround value(which in fact did work) but then the text stopped to change, and after that it just breaks, and shows the gui when the player is in lobby, and hides it when the player is in round.
My code is (Main Script):
local roundLength = 5
local intermissionLength = 5
local status = game.ReplicatedStorage.IntermissionStatus
local inround = game.ReplicatedStorage.InRound
local chosenRandomNumberValue = game.ReplicatedStorage.chosenNumber
local displaychosenrole = game.StarterGui.areyoumurdorsherifforinno.Chosen.TextLabel
local tof = game.ReplicatedStorage.displayChosenTOF
local player = game.Players.LocalPlayer
local chosenRoleValue = game.ReplicatedStorage.TheChosenRole
local murdererteam = game.Teams.Murderer
local sheriffteam = game.Teams.Sheriff
local innocentteam = game.Teams.Innocent
local mineshaft = game.Workspace.MineshaftSpawn
local milbase = game.Workspace.MilbaseSpawn
local lobby = game.Workspace.LobbySpawn
local colorRed = Color3.new(255/255, 0/255, 4/255)
local colorBlue = Color3.new(16/255, 40/255, 255/255)
local colorGreen = Color3.new(3/255, 255/255, 19/255)
inround.Changed:Connect(function()
if inround.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
local randomMapNumber = math.random(1,2)
if randomMapNumber == 1 then
char.HumanoidRootPart.CFrame = mineshaft.CFrame
elseif randomMapNumber == 2 then
char.HumanoidRootPart.CFrame = milbase.CFrame
end
local randomNumber = math.random(1,3)
if randomNumber == 1 then
player.TeamColor = BrickColor.new("Really red")
chosenRoleValue.Value = "MURDERER"
elseif randomNumber == 2 then
player.TeamColor = BrickColor.new("Electric blue")
chosenRoleValue.Value = "SHERIFF"
elseif randomNumber == 3 then
player.TeamColor = BrickColor.new("Lime green")
chosenRoleValue.Value = "INNOCENT"
end
end
else
for _,player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = lobby.CFrame
player.TeamColor = BrickColor.new("White")
chosenRoleValue.Value = "NEUTRAL"
end
end
end)
local function roundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
inround.Value = false
wait(1)
status.Value = "Intermission: ".. i .." seconds left!"
wait(1)
end
for i = roundLength, 1, -1 do
inround.Value = true
wait(1)
status.Value = "Game: ".. i .." seconds left!"
end
end
end
spawn(roundTimer)
My code for the gui script:
local chosenNumber = game.ReplicatedStorage.chosenNumber
local status = script.Parent.TextLabel
local tof = game.ReplicatedStorage.displayChosenTOF
local chosenRole = game.ReplicatedStorage.TheChosenRole
local inround = game.ReplicatedStorage.InRound
chosenRole.Changed:Connect(function()
if chosenRole.Value == "MURDERER" then
status.TextColor3 = Color3.new(255/255, 0/255, 4/255)
status.Text = "MURDERER"
if inround.Value == true then
script.Parent.Parent.Chosen.Visible = true
wait(5)
script.Parent.Parent.Chosen.Visible = false
end
elseif chosenRole.Value == "SHERIFF" then
status.TextColor3 = Color3.new(16/255, 40/255, 255/255)
status.Text = "SHERIFF"
if inround.Value == true then
script.Parent.Parent.Chosen.Visible = true
wait(5)
script.Parent.Parent.Chosen.Visible = false
end
elseif chosenRole.Value == "INNOCENT" then
status.TextColor3 = Color3.new(3/255, 255/255, 19/255)
status.Text = "INNOCENT"
if inround.Value == true then
script.Parent.Parent.Chosen.Visible = true
wait(5)
script.Parent.Parent.Chosen.Visible = false
end
elseif chosenRole.Value == "NEUTRAL" then
status.TextColor3 = Color3.new(255/255, 255/255, 255/255)
status.Text = "NEUTRAL"
if inround.Value == true then
script.Parent.Parent.Chosen.Visible = true
wait(5)
script.Parent.Parent.Chosen.Visible = false
end
end
end)
also the main script is an "script" and the second is an "local script"

10 comments
Also, please note I made an error while typing. I meant that everybody would be Neutral, because the change is broadcasted everywhere.
that didnt help me, but it gave me an idea on how to make my game safer from exploiters
Glad to hear that! I’ll continue to look at the script and see if I can find any fixes for the issues you just listed.
also i have an question, how do you get the "if event is fired" value
Use OnServerEvent on a server script and OnClientEvent on a local script. For more information on remote events, go here: https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
umm its been awhile...
He literally said what you need to do lmao.
Yes, and didnt work
I listed a resource on Remote Events and Functions. Did you read that?
I listed a resource on Remote Events and Functions. Did you read that?