Ok so i was making a round system. First off it was working good and all even was tagging all players. But now it doesnt tag current player. We was testing it with small group of people and im scared that it cannot work on other players too. The problem is it doesnt add seeker (only seeker) tag for player. I dont know reason.
local module = {}
local seekers = {} --Currently playing seekers
local hider = nil --Selected hider
local playing = false --Is round active?
local canTouch = false --Can seekers tag hider?
local botModule = require(game.ReplicatedStorage.BotModule)
--//SETTINGS\\--
local intLength = 15 --Intermission length
local roundLength = 420 --Round length
local status = game.ReplicatedStorage.RoundStatus --Game status
local requiredPlayers = 2 --How many players need to start game.
local timeToHide = 10 --Time for hider to hide.
local blindTime = 10 --How long seekers will be blinded.
local amountToGivePerGame = 10 --How much money player will get when round starts.
local bonusMoney = 20 --How much money player will get if he got hider.
local winMoney = 30 --How much money player will get if he won.
--//FUNCTIONS\\--
function module.Intermission()
if #game.Players:GetPlayers() >= requiredPlayers then
if playing == false then
for i = intLength,0,-1 do
if #game.Players:GetPlayers() < requiredPlayers then
module.Intermission()
break
end
status.Value = "Intermission. "..i
wait(1)
end
RoundStart()
end
else
status.Value = "2 players required."
wait()
module.Intermission()
end
end
function RoundStart()
playing = true
for i,player in pairs(game.Players:GetPlayers()) do
table.insert(seekers,player)
player.Stats.FlushCoins.Value += amountToGivePerGame
end
hider = PickHider(seekers)
status.Value = hider.Name.." is a hider!" --Announce who is hider.
wait(1)
local map = game.ReplicatedStorage.GameMaps:GetChildren()[math.random(1,#game.ReplicatedStorage.GameMaps:GetChildren())]:Clone()
map.Parent = game.Workspace
status.Value = map.Name.." will be gaming B) zone." --Announce selected map.
if map:FindFirstChild("Bots") then
for i,v in pairs(map.Bots:GetChildren()) do
botModule.AddClothes(v)
end
end
for i,player in pairs(seekers) do
if player then
local char = player.Character
if char then --Working with player
else --Player isn't avaible
if not player then
print("Player isn't avaible.")
table.remove(seekers,i) --Removing player from the game
end
return
end
end
end
wait(3)
status.Value = "Get ready for gaming B)" --Announce about soon start.
wait(2)
for i,v in pairs(seekers) do
v:LoadCharacter()
v.PlayerGui.ShopGui:Destroy()
if v.UserId == hider.UserId then
script.PowerUps[v.Stats.HiderPower.Value.."Gui"]:Clone().Parent = v.PlayerGui --Adding player power up
table.remove(seekers,i)
local hideTag = Instance.new("BoolValue",v.Character) --Adding game tag for hider.
hideTag.Name = "HideTag"
hideTag.Parent = v.Character
v.Character.HumanoidRootPart.CFrame = map.Spawns.Spawn.CFrame
elseif not v.UserId == hider.UserId then
script.SeekGui:Clone().Parent = v.PlayerGui --Adding seekers gui
script.PowerUps[v.Stats.SeekerPower.Value.."Gui"]:Clone().Parent = v.PlayerGui --Adding player power up
local SeekTag = Instance.new("BoolValue") --Adding game tag for seeker
SeekTag.Name = "SeekTag"
SeekTag.Parent = v.Character
v.Character.Humanoid.WalkSpeed = 0
v.Character.Humanoid.JumpPower = 0
v.Character.HumanoidRootPart.CFrame = map.Spawns.SeekSpawn.CFrame
end
end
game.ReplicatedStorage.CurrentHider.Value = hider
game.Lighting.BilndEffect.Enabled = true
game.ReplicatedStorage.BlindEvent:FireClient(hider)
for i = roundLength,0,-1 do --Starting up timer
if i <= roundLength - blindTime then
game.Lighting.BilndEffect.Enabled = false
canTouch = true
for i,v in pairs(seekers) do
local char = v.Character
if char then
v.Character.Humanoid.WalkSpeed = 16
v.Character.Humanoid.JumpPower = 50
end
end
end
for x,player in pairs(seekers) do
local char = player.Character
if player and canTouch == true then
if not char then --Player left game
print("Player left the game.")
table.remove(seekers,x) --Removing player from the game
end
if not char:FindFirstChild("SeekTag") then
table.remove(seekers,x)
print("seeker died")
end
end
end
status.Value = "Gaming B) "..i.." seconds left." --Announce how many time left.
if not hider.Character then
status.Value = "Hider has left the game!" --Announce that hider has left the game. Seekers won.
i = math.huge
wait(5)
module.RoundEnd(map)
break
elseif #seekers <= 0 then
status.Value = "Game ended. Hider won!" --Announce that all seekers was removed. Hider won.
hider.Stats.FlushCoins.Value += winMoney
module.RoundEnd(map)
break
elseif not hider.Character:FindFirstChild("HideTag") then
status.Value = "Game ended. Seekers won!" --Announce that hider was caught. Seekers won.
for i,v in pairs(seekers) do
v.Stats.FlushCoins.Value += winMoney
end
module.RoundEnd(map)
break
end
hider.Character.HumanoidRootPart.Touched:Connect(function(hit) --Making tag for seekers.
if hit.Parent:FindFirstChild("SeekTag") and i <= roundLength - blindTime and canTouch == true and hider.Character:FindFirstChild("HideTag") then
hider.Character.Humanoid.Health = 0
hider.Character.HideTag:Destroy()
local p = game.Players:GetPlayerFromCharacter(hit.Parent)
p.Stats.FlushCoins.Value += bonusMoney
game.ReplicatedStorage.KillScreenEvent:FireAllClients(p)
end
end)
wait(1)
end
if playing == true then
status.Value = "Game ended. Hider won!" --Announce that time out. Hider won.
hider.Stats.FlushCoins.Value += math.random(150,200)
module.RoundEnd(map)
end
end
function module.RoundEnd(map)
playing = false
canTouch = false
game.Lighting.BilndEffect.Enabled = false
hider = nil
map:Destroy()
for i,player in pairs(seekers) do
player:LoadCharacter()
end
table.clear(seekers)
wait(2)
status.Value = "Get some rest."
wait(5)
module.Intermission()
end
function PickHider(players)
return players[math.random(1,#players)]
end
return module
Thank you for helping!