Hey everyone I’m currently working on…nvm it’s not important but like I want the textButton appear when I’m on “Lobby” Team position and I want it to dissapear when im on “Playing” Team Position, these are like 2 different spots or sth. like that
here’s a script that may help a bit and the local script should be the child of the TextButton(TextButtonName=OpenSendTrades)
local intermission = 50
local roundLength = 180
local inRound = game.ReplicatedStorage.InRound
local staus = game.ReplicatedStorage.Status
local playingTeam = game.Teams.Playing
local lobbyTeam = game.Teams.Lobby
local murderMysteryModule = require(game.ReplicatedStorage.MurderMysterySystem)
inRound.Changed:Connect(function()
if inRound.Value == true then
for i, plr in pairs(game.Players:GetChildren()) do
local char = plr.Character
local humanRoot = char:WaitForChild("HumanoidRootPart")
plr.Team = playingTeam
char:WaitForChild("Humanoid").Died:Connect(function()
plr.Team = lobbyTeam
end)
end
else
for i, plr in pairs(game.Players:GetChildren()) do
local char = plr.Character
local humanRoot = char:WaitForChild("HumanoidRootPart")
local human = char:WaitForChild("Humanoid")
humanRoot.CFrame = game.Workspace.lobbySpawn.CFrame
plr.Team = lobbyTeam
human:UnequipTools()
plr.Backpack:ClearAllChildren()
end
end
end)
local function round()
while true do
local requiredPlayers = 2
repeat
wait(1)
staus.Value = "Atleast ".. requiredPlayers.." players are needed to start a round"
until #game.Players:GetChildren() >= requiredPlayers
inRound.Value = false
for i = intermission, 0, -1 do
staus.Value = "Game will start in "..i.." seconds"
wait(1)
end
inRound.Value = true
local msg = murderMysteryModule.ChooseRoles()
for i = roundLength, 0, -1 do
staus.Value = "Game will end in "..i.." seconds"
local playing = {}
for i, plr in pairs(game.Players:GetChildren()) do
if plr.Team.Name == "Playing" then
table.insert(playing, plr.Name)
end
end
local MurdererAlive = false
local NonMurdererAlive = false
local murderer
for i, playerInRound in pairs(playing) do
if game.Players:FindFirstChild(playerInRound):WaitForChild("Role").Value == "Murderer" then
MurdererAlive = true
murderer = game.Players:FindFirstChild(playerInRound)
elseif game.Players:FindFirstChild(playerInRound):WaitForChild("Role").Value ~= "Murderer" then
NonMurdererAlive = true
end
end
if #playing == -1 then
staus.Value = "Everyone Has Died"
wait(3)
break
end
if MurdererAlive == true and NonMurdererAlive == false then
staus.Value = playing[1].." The Murderer Has Won!"
wait(3)
break
end
if (MurdererAlive == false and NonMurdererAlive == true) or NonMurdererAlive == true and i == 0 then
staus.Value = playing[1].." The Innocents Have Won!"
wait(3)
break
end
wait(1)
end
wait(3)
end
end
spawn(round)