• How to make this do it again?
    0 replies, posted
Hello, I was trying to make this script but when i try to add another item it won't register the first one? So what i am trying to do it call the same function again but with another prop and a different outcome but once i do this it will just not register the first function. How can i make this so it will do both? This is the code. [CODE]function ENT:StartTouch(ent) if ent:GetClass() == "ent_dough" and self.isCooking == false then ent:Remove() self.isCooking = true self.finishCookingTime = CurTime() + 5 end end function ENT:Think() if self.isCooking == true then self:SetColor(Color(255,0,0)) else self:SetColor(Color(255,255,255)) end if self.isCooking == true then if self.finishCookingTime <= CurTime() then self.isCooking = false local buns = ents.Create("ent_buns") buns:SetPos(self:GetPos() + Vector(0,0,25)) buns:Spawn() end end end[/CODE] Many thanks [editline]21st December 2016[/editline] So i've changed it and it works but it will spawn them both at the same time, This is my code now. [lua]function ENT:StartTouch(ent) if ent:GetClass() == "ent_dough" and self.isCooking == false then ent:Remove() self.isCooking = true self.finishCookingTime = CurTime() + 5 end if ent:GetClass() == "ent_rawburger" and self.isCooking == false then ent:Remove() self.isCooking = true self.finishCookingTime = CurTime() + 5 end end function ENT:Think() if self.isCooking == true then self:SetColor(Color(255,0,0)) else self:SetColor(Color(255,255,255)) end if self.isCooking == true then if self.finishCookingTime <= CurTime() then self.isCooking = false local buns = ents.Create("ent_buns") buns:SetPos(self:GetPos() + Vector(0,0,25)) buns:Spawn() local cookedburger = ents.Create("ent_cookedburger") cookedburger:SetPos(self:GetPos() + Vector(0,0,25)) cookedburger:Spawn() end end end [/lua] [editline]21st December 2016[/editline] How can i make it so it spawns only one or the other?
Sorry, you need to Log In to post a reply to this thread.