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

[Not needed anymore] random color help?

Asked by 3 years ago
Edited 3 years ago

I made a script where it changes to random brick colors, and I want to make it so that when the color randomly goes to white, it damages the players and takes away some health. Except, it always takes away health weather the color is white or not. Here are my scripts that are in the part:


while true do script.Parent.BrickColor = BrickColor.Random() wait(2) end

(in 2 different scripts)

while true do
    if script.parent.BrickColor == BrickColor.White() or BrickColor.new("Institutional white") or BrickColor.new("Pearl") or BrickColor.new("Lily white") or BrickColor.new("Quill grey") or BrickColor.new("Mid gray") or BrickColor.new("Ghost grey") 
    then
        function onTouch(part) 
 local humanoid = part.Parent:FindFirstChild("Humanoid") 
 if (humanoid ~= nil) then
    humanoid.Health = -25 
     end 
end

script.Parent.Touched:connect(onTouch)
    end
    wait(.01)
end

Do you see any problems with it? Thank you in advance!

0
Put your code in code blocks please Cynical_Innovation 595 — 3y
0
Ok, I did H0ney_Beeee 8 — 3y

Answer this question