Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my sword fighting game not working?

Asked by 5 years ago

I am trying to make a sword fighting game but it's not working. I haven't got any errors but I am not teleporting to the map. Please help me! Here is the script:

-- Define Variables

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ServerStorage = game:GetService("ServerStorage")

local MapsFolder = ServerStorage:WaitForChild("Maps")

local Status = ReplicatedStorage:WaitForChild("Status")

local GameLength = 60

local reward = 10

-- Game loop

while true do

001Status.Value = "Waiting for at least 2 players.."
002 
003repeat wait(1) until game.Players.NumPlayers >= 2
004 
005Status.Value = "Intermission"
006 
007wait(10)
008 
009local plrs = {}
010 
011for i, player in pairs (game.Players:GetPlayers()) do
012    if player then
013        table.insert(plrs,player) -- Add each play into plrs table
014    end
015end
View all 112 lines...

end

print ("End of game")

for i, player in pairs(game.Players:GetPlayers()) do character = player.Character

01if not character then
02    -- Ignore them
03else
04    if character:FindFirstChild("GameTag") then
05        character.GameTag:Destroy()
06    end
07 
08    if player.Backpack:FindFirstChild("Sword") then
09        player.Backpack.Sword:Destroy()
10    end
11 
12    if character:FindFirstChild("Sword") then
13        character.Sword:Destroy()
14    end
15 
16end
17 
18player:LoadCharacter()

end

ClonedMap:Destroy()

Status.Value = "Game ended"

wait(5) end

Answer this question