Hi, I'm trying to make a system where there are 3 blocks that a team needs to touch and then a countdown will start.
The problem is that the bricks change colour when they're touched, like they're supposed to, but they don't seem to change the BoolValue I have set to true. The BoolValue is inside a part. The script I have for one of the points -
ValueA = game.Workspace.PartA.ValueA.Value
raidcolor = "Cool yellow"
defcolor = "Earth green"
script.Parent.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new(raidcolor) then
ValueA=true
script.Parent.BrickColor = BrickColor.new("Cool yellow")
print 'a is capped'
end
end
end)
script.Parent.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil then
if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new(defcolor) then
ValueA=false
script.Parent.BrickColor = BrickColor.new("Earth green")
print 'a is uncapped'
end
end
end)
Thanks, values not changing is fixed. New problematic code, where the timer will not start (sorry).
timer=1
totaltimer=1
ValueA = game.Workspace.PartA.ValueA
ValueB = game.Workspace.PartB.ValueB
ValueC = game.Workspace.PartC.ValueC
if ValueA.Value == true and ValueB.Value == true and ValueC.Value == true then
repeat
print'cool'
wait(1)
timer = timer + 1
until
timer > 3
if timer > 3 then
timer=totaltimer
end
game.Lighting.RaidersWin:Clone().Parent = game.Players.LocalPlayer.PlayerGui
for i, player in ipairs(game.Players:GetPlayers()) do
if player.Character then
local hum = player.Character:FindFirstChild('Humanoid')
if hum then
hum.Health = 0
timer=totaltimer
ValueA.Value=false
ValueB.Value=false
ValueC.Value=false
game.Workspace.PartA.BrickColor.new=BrickColor.new"Earth green"
game.Workspace.PartB.BrickColor.new=BrickColor.new"Earth green"
game.Workspace.PartC.BrickColor.new=BrickColor.new"Earth green"
end
end
end
end
Thanks for reading!

2 comments
Thanks! This fixed half my problem. Sorry to bother again but I edited my post with a new issue.
Could you explain the problem with the second code and what it's expected to do?