I'm trying to make a murder mystery game to see if I can do it but I want to do that the murder doesn't become the sheriff too, I wrote a code but it won't work, Can anyone help me?
Module script:
local functions = {}
local serverStorage = game:GetService("ServerStorage")
local sword = serverStorage:WaitForChild("Assets"):WaitForChild("ClassicSword")
local gun = serverStorage:WaitForChild("Assets"):WaitForChild("HyperlaserGun")
functions.chooseRandomSherrif = function()
local players = game:GetService("Players"):GetPlayers()
local Sherrif = players[math.random(1,#players)]
local clonedGun = gun:Clone()
local sherrifTag = Instance.new("BoolValue")
if Sherrif:WaitForChild("Murder") then
sherrifTag.Name = "Sherrif"
sherrifTag.Parent = Sherrif.Character
clonedGun.Parent = Sherrif.Backpack
end
end
functions.chooseRandomMurder = function()
local players = game:GetService("Players"):GetPlayers()
local Murder = players[math.random(1,#players)]
local clonedSword = sword:Clone()
local murderTag = Instance.new("BoolValue")
if not Murder:WaitForChild("Sherrif") then
murderTag.Name = "Murder"
murderTag.Parent = Murder.Character
clonedSword.Parent = Murder.Backpack
end
end
return functions

1 comment
You can do 'if not Player.BoolValue' then...