check the return code of the creep.claimController function, it will tell you why its failing.
var result = creep.claimController(creep.room.controller);
console.log(creep + " tried to claim controller, got result " + result);
OK 0 The operation has been scheduled successfully.
You are not the owner of this creep.
The creep is still being spawned.
The target is not a valid neutral controller object.
You cannot claim more than 3 rooms in the Novice Area.
The target is too far away.
There are no CLAIM body parts in this creep’s body.
Your Global Control Level is not enough.