• I need help on using contraint.Rope
    2 replies, posted
I'm basically making a weapon that you can fling around a cube to kill people with, but I'm having trouble with the rope part. Here's my code: function SWEP:PrimaryAttack() if self.Shot == nil then self.Shot = true local entity = ents.Create("prop_physics") entity:SetModel("models/hunter/blocks/cube025x025x025.mdl") entity:SetPos(self:GetPos()) entity:Spawn() local rope = constraint.Rope(self, entity, 0, 0, Vector(0, 0, 0), Vector(0, 0, 0), 50, 0, 0, 10, "cable/rope", false) print(rope) end end But for some reason it returns false, what do I do?
Argument #1 needs to be an entity. You're supplying self which is the SWEP object, not an entity. You can set it to self.Owner which ties the rope to the player but you might want to spawn another entity and nocollide it with the player to use that as the source of the rope.
I actually tried that before, but I couldn't position it correctly. I've messed with it a lot and got it at the right position, thanks for letting me know that this is the correct way.
Sorry, you need to Log In to post a reply to this thread.