a=script.Parent.Parent.Door function onTouch(hit) print(hit) if hit.Parent.IntValue.Value==2 then a.Transparency=1 script.Parent.BrickColor=BrickColor.new("Lime green") a.CanCollide=false wait(3) a.Transparency=0.6 a.CanCollide=true script.Parent.BrickColor=BrickColor.new("Really red") end end script.Parent.Touched:connect(onTouch)
So basically the point of this creation is to get the tool, and if the tool has an IntValue inside of it with a value of 2, the door is supposed to open. However it just sends a message back saying IntValue is not a valid member of model, I even tried using simply just Value. Please help?
Alright, lots of what's happening here is wrong lol.
local Door =script.Parent.Parent.Door -- Don't use single letters, and USE LOCAL function onTouch(hit) print("hit") -- It's just for testing reasons, right? if hit.Parent:FindFirstChild("IntValue") ~= nil then -- Will return nil if there's no Value if hit.Parent.IntValue.Value~=2 then return end Door.Transparency=1 script.Parent.BrickColor=BrickColor.new("Lime green") Door.CanCollide=false wait(3) Door.Transparency=0.6 Door.CanCollide=true script.Parent.BrickColor=BrickColor.new("Really red") end end script.Parent.Touched:Connect(onTouch) --Make sure :Connect is in caps