Hi all Im so lost now on what im missing here.,
I have about 50 bricks under a Model. When someone runs over it, i want it to change color, then after like 30 seconds, change back to another color. I would like this to work for multiple players at the same time, individually.
This is what i have but i cant seem to get it together correctly.
---`
local AllChildren = {}
function GetEveryChild(a) for i,v in pairs(a:GetChildren()) do table.insert(AllChildren, #AllChildren+1, v) GetEveryChild(v) end end
GetEveryChild(game.Workspace.Model.Modelx)
for i,v in pairs(game.Workspace.model.Modelx:GetChildren() ) do if v:IsA("Part") then v.BrickColor = BrickColor.Green()
end
end workspace.Part.Touched:connect(function(hit)
game.Workspace.BrickColor = BrickColor.new("Really red")
wait(5)
end)
My original script i have working 100% ,i saved under the part itself, but i have like 100 of them. Trying to make 1 script for all.
original script...
script.Parent.BrickColor = BrickColor.Green() script.Parent.Material = "Glass"
local debounce = false function onHit(hit) local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then debounce = true
script.Parent.BrickColor = BrickColor.White() script.Parent.Material = "Neon" wait(30) debounce = false script.Parent.BrickColor = BrickColor.Green() script.Parent.Material = "Glass" end end
script.Parent.Touched:connect(onHit)

3 comments
Where exactly is the problem?
That is exactly what im trying to figure out =). Its just not working for me.
I have messed around with this code so many times, trying different function formats, seems like i keep messing it up more.