I have a brick that becomes visible on humanoid touch, but I want the color of the brick to be random on humanoid touch as well. Any help?
function Hybric(hit) local g = hit.Parent:findFirstChild("Humanoid") if (g ~= nil) then Workspace.Part.Color = Color3.new(math.random(), math.random(), math.random()) end end script.Parent.Touched:connect(Hybric)
Well what you are saying when a Humanoid touches it well I dont know how to make it only when a Humanoid touches it but I can do when anything touches it.
function onTouched (hit) script.Parent.BrickColor = BrickColor.Random() wait(5.0) end script.Parent.touched:connect(onTouched)
Here,This random() method is used to set a random value out of the available not including nil and to do that we use the event function that activates it.
function Touched(hit) if hit.Parent:findFirstChild("Humanoid") then Workspace.Part.BrickColor:random() end end script.Part.Touched:connect(Touched)