So i was using a code made by HowToRoblox and tried to modified it here's the code that I modified
I have added a BoolValue named it Ingame
This script is in the ServerScriptService
There's no errors in this script but I don't understand what I did wrong sorry --edited
local killerWeapon = game.ServerStorage.ClassicSword local plrs = game.Players local survivors = {} local Ingame = game.ReplicatedStorage.InGame while wait(Ingame.value == true) do local chosen = plrs:GetChildren()[math.random(1, #plrs:GetChildren())] chosen.PlayerGui.Picker.Background.RoleGiven.Text = "Murder" chosen.PlayerGui.Picker.Background.RoleGiven.TextColor3 = Color3.fromRGB(0, 0, 0) chosen.PlayerGui.Picker.Background.Visible = true killerWeapon:Clone().Parent = chosen.Backpack 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, 200, 0) plr.PlayerGui.Picker.Background.Visible = true wait() end end end
Do you guys think you can fix what I have done wrong?
the error might be that you put while wait(Ingame.value == true) do instead of while Ingame.Value == true because wait needs a number not a bool like true or false, do
while Ingame.value == true do
also, you put plr == chosen instead of plr.Name == chosen.Name, change that