I made a script to make a shockwave when the boss lands after jumping. The thing is, how would I tell if he's back on the ground? (No OnTouched the boss will be on multiple bricks and I don't want to much lag)
Well, if you have parts on your boss, then you can use Position and an if statement. For example,
01 | OnGround = false -- Assuming the boss starts on the ground |
02 | BossTorso = workspace.(Boss model).(Boss's chest) |
03 | --Replace those with the bosses chest, and where it says (Boss model) is what the boss's torso is stored under. If it's not workspace, change it to the location of the boss |
04 | DesiredHeight = --(Whatever the grounds y is to find it, click on the ground and look under "Position" and "Y") --This is where he has to be to be "on the ground" |
05 | BossHeight = --(You can experiment here but I'd probably recommend 7, or so depending on how tall your boss is) --This is subtracted from the value because you're measuring the torso |
06 | while 1 = = 1 do --Repeats 4ever |
07 | if BossTorso.Position.y < = DesiredHeight + BossHeight then --Checks if the bosses torso 5 studs away from the ground |
08 | OnGround = true |
09 | break --breaks loop remove this if you want it to go on forever. |
10 | end |
11 | wait( 1 ) |
12 | end |
I told you want to replace in the comments of the script, try using that reply if that doesn't make sense. Use OnGround in a loop, to see if he hits the ground, for example,
1 | while 2 = = 2 do |
2 | if OnGround = true |
3 | --Do whatever you're shockwave thing is |
4 | end |
5 | wait( 1 ) |
6 | end |
If I were to have a brick in workspace, called "Torso", then this script will work for it.
01 | OnGround = false |
02 | BossTorso = workspace.Torso |
03 | DesiredHeight = - 10 |
04 | BossHeight = 3 |
05 | while 1 = = 1 do |
06 | if BossTorso.Position.y < = DesiredHeight + BossHeight then |
07 | OnGround = true |
08 | break |
09 | end |
10 | wait( 1 ) |
11 | end |
12 | while 1 = = 1 do |
13 | if OnGround = = true then |
14 | print ( "Yo" ) |
15 | break |
16 | end |
17 | wait( 1 ) |
18 | end |
Assuming that your baseplate is really thin, if it's thick, change the BossHeight to something like 10 or 20. This prints "Yo" Whenever it touches the ground.