#Why does my backstab code doesn't work? It just damages the normal damage (1 dmg).

1 messages · Page 1 of 1 (latest)

light copper
#

Because dotProduct is not negative

#
local angle = hitboxLookVector:Angle(rootPartLookVector)
directionMultiplier = math.sign(angle - math.pi/2)
misty osprey
#

oops

#

damn

light copper
#

This is code I used to know which side to open a door from

misty osprey
#

im a fool

#

lmao it worked with only 1 change

#

thanks btw

light copper
#

ye

misty osprey
#

math.sign(angle - math.pi/2)

light copper
#

Basically, angle will return a value between 0 and math.pi (3.14)

misty osprey
#

anyways changed it and now only backstabbing i guess i need help again

light copper
#

If I substract half of math.pi

#

and use math.sign

#

I'll get a value that's 1 or -1

misty osprey
#

how do i implement it?

light copper
#
leftGateHinge.TargetAngle = 90 * -directionMultiplier
    rightGateHinge.TargetAngle = 90 * directionMultiplier
#

this is for my gates

misty osprey
#

i'll look now

#

okay so i need angles

#

but

#

i dont really know what to write right now

#

ill try doing if -90 if elseif 90

light copper
#

Vector3:Angles() is the same thing as math.acos(vector1:Dot(vector2))

misty osprey
#

can't seem to make it work

#

i understood it with researching math.sign and angles but still cant implement it lol

light copper
#

use math.deg() with angles and print it

#

so you can see what values you're getting

misty osprey
#

sure ill continue the script tomorrow

#

good night and thanks for information