Welcome to the Forums!
Join thousands of other Roblox members with a free account.
Create Forum Account

I got a script for a 2 Teams RPG game,but they always spawn at the same spawn,could someone tell me what I did wrong and how I fix that

  • This website was created by Roblox members to replace the official forums (because Roblox shut them down) Join us if you like Roblox!

Lost

New Member
Reputation: 0 / 0 / 0
Feb 16, 2021
1
0
1
Roblox
Zocker683
That is the script

local replicatedStorage = game:GetService("ReplicatedStorage")
local Status = replicatedStorage:WaitForChild("Status")
local InGameBool = replicatedStorage:WaitForChild("InGame")
local MapsFolder = replicatedStorage:WaitForChild("Maps")
local Maps = MapsFolder:GetChildren()



InGameBool.Changed:Connect(function()

if InGameBool.Value == true then

-- Choose Map

local ChosenMap = Maps[math.random(1,#Maps)]

local ClonedMap = ChosenMap:Clone()

ClonedMap.Parent = game.Workspace

wait(2)

-- Teleport Players To Map



for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character or player.CharacterAdded:Wait()
char.HumanoidRootPart.CFrame = CFrame.new(ClonedMap.SpawnLocation.Position)



end

else



for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character or player.CharacterAdded:Wait()

char.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Lobby.SpawnLocation.Position) -- Teleports
-- Destroy The Old Map
if game.Workspace:FindFirstChild("Dessert") then
game.Workspace.Dessert:Destroy()
elseif game.Workspace:FindFirstChild("GrassMap") then
game.Workspace.GrassMap:Destroy("GrassMap,Dessert")

end

end

end

end)



local function changeTimer()

InGameBool.Value = false

for i = 20,0,-1 do

wait(1)

Status.Value = "Intermission "..i.." Seconds Before New Match!"

end

InGameBool.Value = true

for i = 60,0,-1 do

wait(1)

Status.Value = "In Game "..i.." Seconds Left Before Game Ends!"







end

end



while wait() do

changeTimer()

end