Im making a murder mystery type game and i have guis to display the role of the player when the round starts. The game is locked in first person so i cant add a button and i want it to automatically close after 4 seconds. however, everything i try wont work. here is my code:
local killerWeapon = game.ServerStorage.Knife
local plrs = game.Players
local inRound = game.ReplicatedStorage.inRound
local survivors = {}
inRound.Changed:Connect(function()
if inRound.Value == true then
local chosen = plrs:GetChildren()[math.random(1, #plrs:GetChildren())]
chosen.PlayerGui.Picker.Background.RoleGiven.Text = "Murderer"
chosen.PlayerGui.Picker.Background.RoleGiven.TextColor3 = Color3.fromRGB(255, 0, 0)
chosen.PlayerGui.Picker.Background.Visible = true
killerWeapon:Clone().Parent = chosen.Backpack
print("killer")
for i, plr in pairs(plrs:GetChildren()) do
if plr ~= chosen then
table.insert(survivors, plr)
plr.PlayerGui.Picker.Background.RoleGiven.Text = "Survivor"
plr.PlayerGui.Picker.Background.RoleGiven.TextColor3 = Color3.fromRGB(0, 255, 0)
plr.PlayerGui.Picker.Background.Visible = true
print("survivor visible")
end
end
end
end)

2 comments
I tried this code but the gui didnt appear. I also put some prints in but they didnt work either.
because you suck at scripting ez ez ez ez