Hi I'm working on a game and I'm trying to work out a few script problems since I'm a beginner. This is what I have so far;
--Line 1
minigames = game.ReplicatedStorage.Minigames:GetChildren()
h = Instance.new("TextLabel", game.StarterGui.ScreenGui.TextLabel)
h.Size = UDim2.new(0, 980, 0, 20) --Make sure to use UDim2, NOT Vector3
h.Position = UDim2.new(.5, -500, .5, -1)
h.Text = "Stuff" --Make sure this is a string
h.BackgroundColor3 = Color3.new(0, 0, 0) --GUIs only accept Color3 values, which range from 0 to 1. To convert other colors to Color3, divide each number by 255. In this case, white is (255, 255, 255) and 255/255 = 1.
h.TextColor3 = Color3.new(1, 1, 1)
h.BackgroundTransparency = (0.5)
function removePlate()
plates = game.Workspace.Disappearing Plates.Plates:GetChildren()
ranNum1 = math.random(1,#plates)
ranNum2 = 1
while ranNum1 == ranNum2 do
ranNum2 = math.random(1,#plates)
wait(1)
end
plateChosen = plates[ranNum1]
plateChosen2 = plates[ranNum2]
for i = 0, 1, 0.05 do
plateChosen.Transparency = i
plateChosen2.Transparency = i
wait()
end
plateChosen:Destroy()
plateChosen2:Destroy()
end
while true do
if game.Players.NumPlayers > 1 then
h.Text = "Randomly choosing a map..."
wait(5)
ranGame = math.random(1, #minigames)
gameChosen = minigames[ranGame]
h.Text = "Map chosen: " .. gameChosen.Name
wait(5)
gameChosenClone = gameChosen:Clone()
gameChosenClone.Parent = game.Workspace
wait(5)
--Teleporting people to map
spawns = gameChosenClone.Spawns:GetChildren()
for i,v in pairs(game.Players:GetPlayers()) do
name = v.Name
check = game.Workspace:FindFirstChild(name)
if check then
checkHumanoid = check:FindFirstChild("Humanoid")
if checkHumanoid then
v.Character:MoveTo(spawns[i].Position)
v.InGame.Value = true
end
end
end
for i = 3, 0, -1 do
h.Text = "Game begins in: " .. i
wait(1)
end
if game.ChosenClone.Name == "Disappearing Plates" then
time = 20
--Countdown until game ends
for i = time, 1, -1 do
h.Text = "Time left: " .. i
removePlate()
end
elseif game.ChosenClone.Name == "Sword Frenzy" then
gameChosenClone.SwordFrenzyScript.Disabled = false
while script.RoundFinished.Value == false do
wait(1)
end
elseif game.ChosenClone.Name == "Office Terror" then
gameChosenClone.SwordFrenzyScript.Disabled = false
while script.RoundFinished.Value == false do
wait(1)
end
script.RoundFinished.Value = false
end
h.Text = "Game over!"
wait(5)
h.Text = "Giving points to the winner(s)..."
for i, v in pairs(game.Players:GetPlayers())do
inGame = v:FindFirstChild("InGame")
if inGame then
if inGame.Value == true then
v.leaderstats.PointsValue = v.leaderstats.Points.Value + 10
end
end
end
wait(5)
gameChosenClone:Destroy()
else
h.Text = "There are not enough players to start..."
end
wait(1)
end
--Line 101
What I want to do is make sure this script will run without errors and add a few elements. First thing I want to add is a way for players InGame to recieve swords at the start of the round ( and if they purchased any I'd want those to be the ones they'd recieve ). Anyone know how to do this?
This is what my script analysis says;
Thanks for the help!
