Hey, so I am making an intense color block game but I have an issue.I want the players to be teleported, waits 3 seconds, the COLOR RED is stated on a text label, wait 5 seconds and the other blocks that are not red disappear and CanCollide - false. I am having trouble figuring out where to put the script for what I stated above.
local roundLength = 180
local intermissionLength = 30
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local LobbySpawn = game.Workspace.LobbySpawn
local GameAreaSpawn = game.Workspace.GameAreaSpawn
InRound.Changed:Connect(function()
if InRound.Value == true then
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = GameAreaSpawn.CFrame
end
else
for _, player in pairs(game.Players:GetChildren()) do
local char = player.Character
char.HumanoidRootPart.CFrame = LobbySpawn.CFrame
end
end
end)
local function roundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: "..i.." seconds left."
end
for i = roundLength, 1, -1 do
InRound.Value = true
wait(1)
Status.Value = "Game: "..i.." seconds left."
end
end
end
spawn(roundTimer)
- game.StarterGui.Colors.LocalScript
local Color = game.ReplicatedStorage.Color
local ColorChosen = script.Parent.ColorChosen
Color.Changed:Connect(function()
ColorChosen.Text = Color.Value
end)
local Status = game.ReplicatedStorage.Status
local TimerDisplay = script.Parent.TimerDisplay
Status.Changed:Connect(function()
TimerDisplay.Text = Status.Value
end)
- The script I was thinking of using ???
ocal red = game.Workspace.Circles.RedCircles.Red
local blue = game.Workspace.Circles.BlueCircles.Blue
local yellow = game.Workspace.Circles.YellowCircles.Yellow
local pink = game.Workspace.Circles.PinkCircles.Pink
local green = game.Workspace.Circles.GreenCircles.Green
local orange = game.Workspace.Circles.OrangeCircles.Orange
local Color = game.ReplicatedStorage.Color
Color.Value = "Red"
wait(5)
local RedChosen = {blue, yellow, pink, green, orange}
RedChosen.CanCollide = false
RedChosen.Transparency = 1
Alright, I managed to make an entire script that should work and the best part is that you donât even have to script in new colours, if you just create more folders, It just works. though just would require you to change all your folder names from âBlueCirclesâ to just âBlueâ. If you have questions ask them
Circles = game.Workspace.Circles:GetChildren() -- gets all the circle folders
while true do
wait(3)
Chosen_Colour = Circles[math.random(1,#Circles)] -- chooses a random batch of circles by generating a random number
-- and just picking whatever colour is assigned to that number
-- (:GetChildren picks in alphabetical order I think)
game.ReplicatedStorage.Colour.Value = Chosen_Colour.Name -- Makes it really simple if your rename the folders with circles
-- inside of them the colour of the circles, (i.e the folder with
-- blue circles is just called "Blue") makes scripting it easier
wait(5) -- waits
for number,Circle_Colours in pairs(Circles) do -- looks complex but just selects all folders with circles in them
for number,Circle_Part in pairs(Circle_Colours:GetChildren()) do -- goes through all those folders and gets the circle parts do
Circle_Part.Transparency = 1 -- This makes every circle invisible
Circle_Part.CanCollide = false
end
end
for number, Circle_Part in pairs(Chosen_Colour:GetChildren()) do -- goes through every circle of the color that was chosen do
Circle_Part.Transparency = 0 -- makes all the of the choosen colour circle visible
Circle_Part.CanCollide = true
end
wait(5) -- waits again
for number,Circle_Colours in pairs(Circles) do -- does the same thing as before but makes all circles visible again
for number,Circle_Part in pairs(Circle_Colours:GetChildren()) do
print("h")
Circle_Part.Transparency = 0 -- This makes every circle visible
Circle_Part.CanCollide = true
end
end
end
Also, this sets the value of Colour to a string instead of a colour value. (ie, it sets it to âBlueâ instead of colour.new(0.2,0.2,0.8) and I kept changing what spelling of color I used, so youâll have to clean that out yourself
Hey so that worked perfectly, thanks alot. But there is one thing I may not have mentioned, sorry for bothering. Would it be possible to make it so that the rounds get gradually quicker (the time between when the gui states the colour and when the other blocks disappear). We could go from 8 seconds (2 rounds), 6 seconds (2 rounds) 5 seconds (1 round) 3 seconds (2 rounds).
Additionally i was wondering if you knew how to make the script execute ONLY when the Game Timer starts and end when all the players are dead OR when the timer finishes.
Iâve made a similar game to this so I can assist you a little bit, but Iâm not going to give you an entire script since you wonât learn anything, and also it would essentially be us just making a game for you.
At the start of the while loop you would make a timer so you would do something like this:
local Timer = 10 -- 10 seconds | Outside the while loop
for i = Timer, 0, -1 do
task.wait(1)
print(i)
end
Now for the rounds you would do something similar to the timer like this:
local Round = 0 -- At the start of the While Loop
-- Inside the while loop
-- Each time a round has ended you would add one to the round like this
Round += 1 -- Adds one
-- Now whenever you want the round to be shorted you would do
if Round == 2 then
task.Wait(4)
else
task.Wait(8)
end
-- As you can see if the round is 2 it will wait 4 seconds instead of 8
-- You could also use a table like this:
local RoundTimer = {
[1] = 10,
[2] = 10, -- The key which is "2" indicates the round, and the value indicates the time
[3] = 5,
}
-- Now whenever there is a wait you can easily do
task.Wait(RoundTimer[round])
-- There are many ways to do this I just put 2 to give you more of a choice.
Hopefully, this was helpful, and that you can learn a bit from it.