function CreatingParts(name, position)
local CreateNewPart = Instance.new("Part", workspace)
CreateNewPart.Anchored = true
CreateNewPart.Position = position
CreateNewPart.Name = name
print("Done")
end
CreatingParts("Help", Vector3.new(4, 2.5, 43))
CreatingParts("LOL", Vector3.new(5, 2.5, 43))
CreatingParts("IHML", Vector3.new(6, 2.5, 43))
CreatingParts("HMM", Vector3.new(7, 2.5, 43))
CreatingParts("Meow", Vector3.new(8, 2.5, 43))
CreatingParts("Bomb", Vector3.new(9, 2.5, 43))
CreatingParts("Solid", Vector3.new(10, 2.5, 43))
CreatingParts("IDKWHATNAMEISHOULDGIVE", Vector3.new(11, 2.5, 43))
CreatingParts("IDK2", Vector3.new(12, 2.5, 43))
CreatingParts("IDK3", Vector3.new(13, 2.5, 43))
wait(15)
if game.Workspace.touchablepart.Touched == false then
wait(1)
game.Workspace.LOL.BrickColor = BrickColor.new("Really red")
elseif game.Workspace.touchablepart.Touched == true then
workspace.LOL.BrickColor = BrickColor.new("Gold")
end
✓ ANSWER ACCEPTED
The conditions of the "if" statements were met but the code inside did not run, Why is that?
2 answers
✓ Accepted answer
Hi! I redid the script!
function CreatingParts(name, position)
local CreateNewPart = Instance.new("Part", workspace)
CreateNewPart.Anchored = true
CreateNewPart.Position = position
CreateNewPart.Name = name
print("Done")
end
CreatingParts("Help", Vector3.new(4, 2.5, 43))
CreatingParts("LOL", Vector3.new(5, 2.5, 43))
CreatingParts("IHML", Vector3.new(6, 2.5, 43))
CreatingParts("HMM", Vector3.new(7, 2.5, 43))
CreatingParts("Meow", Vector3.new(8, 2.5, 43))
CreatingParts("Bomb", Vector3.new(9, 2.5, 43))
CreatingParts("Solid", Vector3.new(10, 2.5, 43))
CreatingParts("IDKWHATNAMEISHOULDGIVE", Vector3.new(11, 2.5, 43))
CreatingParts("IDK2", Vector3.new(12, 2.5, 43))
CreatingParts("IDK3", Vector3.new(13, 2.5, 43))
wait(15)
game.Workspace.touchablepart.Touched:Connect(
function()
wait(1)
game.Workspace.LOL.BrickColor = BrickColor.new("Really red")
end
)
game.Workspace.touchablepart.TouchEnded:Connect(
function()
workspace.LOL.BrickColor = BrickColor.new("Gold")
end
)
TouchEnded will tell you when the part is not being touched!
Happy Scripting ^^
~~SpiralRBX
If You Are Trying To Use The Touched Event Then This Is How It Would Work
function CreatingParts(name, position)
local CreateNewPart = Instance.new("Part", workspace)
CreateNewPart.Anchored = true
CreateNewPart.Position = position
CreateNewPart.Name = name
print("Done")
end
CreatingParts("Help", Vector3.new(4, 2.5, 43))
CreatingParts("LOL", Vector3.new(5, 2.5, 43))
CreatingParts("IHML", Vector3.new(6, 2.5, 43))
CreatingParts("HMM", Vector3.new(7, 2.5, 43))
CreatingParts("Meow", Vector3.new(8, 2.5, 43))
CreatingParts("Bomb", Vector3.new(9, 2.5, 43))
CreatingParts("Solid", Vector3.new(10, 2.5, 43))
CreatingParts("IDKWHATNAMEISHOULDGIVE", Vector3.new(11, 2.5, 43))
CreatingParts("IDK2", Vector3.new(12, 2.5, 43))
CreatingParts("IDK3", Vector3.new(13, 2.5, 43))
workspace.touchablepart.Touched:Connect(function(hit) -- Touched Event
wait(1) -- I Left This From Your Code
workspace.LOL.BrickColor = BrickColor.new("Really red")
wait(1) -- How Long Until It Becomes Gold
workspace.LOL.BrickColor = BrickColor.new("Gold")
end)
I Hope This Is What You Meant
2 comments
0
actually, i meant to make it change color to gold when i touched the part and if i didn't then it would turn red
0
Oof My Bad
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
u gave the opposite colors but still thanks
Oh my bad. Hope this helps!
and also why did that not work with the if statement?
Touched is not a correct property. It has no true or false.
It is more of an event.