the main game script ive been using will not start the game at all at the moment i dont care for gui's i just want the game mechanics to work im not a good scripter so ive been using a muder mystery script off youtube but taking anything to do with the sheriff out is that even a good idea? any ideas of a way to fix the problem? heres my code its alot i appreciate any1 that looks through it Edit: and also the game spawn point isnt always the lobby its somewhere on the map or in the lobby plz help and i am aware of the \ near the end
local roundtimer = 300 local intermissiontime = 25 local serverstorage = game:GetService("SeverStorage") local replicatedstorage = game:GetService("ReplicatedStorage") local debris = game:GetService("Debris") local event = replicatedstorage:WaitForChild("RemoteEvent") local maps = serverstorage:WaitForChild("Maps") local mapholder = game.Workspace.WaitForChild("MapHolder") local statustag = replicatedstorage:WaitForChild("StatusTag") local timertag = replicatedstorage:WaitForChild("TimerTag")
function playeradded(player) local leaderstats = Instance.new("IntValue") leaderstats.Name = "leaderstats"
local points = Instance.new("IntValue")
points.Name = "Points"
points.Parent = leaderstats
lederstats.Parent = player
end
game.Players.PlayerAdded:connect(playeradded) for_, player in pairs(game.Players:GetPlayers()) do playeradded(player) end
--pick a random map statustag.Value = "Loading Map" timertag.Value = -1 mapholder:ClearAllChildren() wait(2) local allmaps = maps:GetChildren() local newmap = allmaps[math.random(1, #allmaps)] newmap.Parent = game.Workspace wait(2)
--waiting for players while true do wait(5) contenstants = {} for_, player in pairs(game.Players:GetPlayers())do if player and player.Character then local humanoid = player.Character:WaitForChild("Humanoid") if humanoid and humaniod.Health > 0 then table.insert(contestants, player) end end end if #contestants >=2 then break
else
statustag.Value = "Waiting For Players"
timertag.Value = -1 end end statustag.Value = "Match" timertag.Value = roundtimer
--chose maniac maniac = contestants[math.random(1, #contestants)]
--tp contenstants local spawnsmodel= newmap:WaitForChild("Spawns")
local spawns = spawnsmodel:GetChildren for_, player in pairs(contenstants) do if player and player.Character and #spawns > 0 then local torso = player.Character:WaitForChild("Torso") local spawnindex = math.random(1, #spawns) local spawn = spawns[spawnindex] if spawn and torso then table.remove(spawns, spawnindex) torso.CFrame = CFrame.new(spawn.Position + Vector3.new(0, 3, 0)) local matchtag = Instance.new("StringValue") matchtag.Name = "MatchTag" matchtag.Parent = player.Character local backpack = player:FindFirstChild("Backpack") if backpack then if player == maniac then local sword = serverstorage:WaitForChild("Sword"):clone() sword.Parent = backpack event:FireAllClients("Class", "Maniac") else event:FireAllClients("Class", "Camper")
end
end
end
end
end spawnsmodel:remove()
-- game ending
local localtimer = roundtime
while localtimer > 0 do
wait(1)
localtimer = localtimer - 1
timertag.Value = localtimer
activecontestants = {}
maniacactive = false
for_, players in pairs(contestants) do
if player then
local character = player.Character
if character then
local matchtag = character:FindFirstChild("MatchTag")
local humnoid = character:FindFirstChild("Humanoid")
if matchtag and humanoid and humanoid.Health > 0 then
if player == maniac then
maniacactive = true
end
table.insert(activecontestants, player)
end
end
end
if #activecontestants <=1 or not maniacactive
break
end
end
-- game results
local gameresults = "PlayersWin"
if maniacactive then
if #contenstants > 2 then
event:FireAllClients("Result", "PlayersWin")
end
else
gameresult = "ManiacWins"
event:FireAllClients("Result", "ManiacWin")
end
end
local lobbyspawns = {}
for_, v in pairs(game.Workspace:WaitForChild("Lobby"):GetChildren())do
if v and v.Name == "LobbySpawn" then
table.insert(lobbyspawns, v)
end
end
for_, player in pairs(activecontestants) do
if player then
if player.Character then
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid then
humanoid:UnequipTools()
end
local randomspawn = lobbyspawns[math.random(1, #lobbyspawns)]
player.Character:MoveTo(randomspawn.Position)
local backpack = player:FindFirstChild("Backpack")
if backpack then
backpack:ClearAllChildren()
end
end
end
--intermission wait
statustag.Value = "Intermission"
timertag.Value = intermissiontime
local localtimer = intermissiontime
while localtimer > 0 do
wait(1)
localtimer = localtimer - 1
timertag.Value = localtimer
end

1 comment
umm i live in a dirrent time zone so tha time is very difficult to wake up at