# We are defining a script that runs on our island. # Think of this as the "Game Rules" book. script MovingTargetScript is not runable # This is a "Variable". # In Fortnite terms: This is like your "Health Bar". # It changes during the game. Here, it stores the target object. Target: object = none # This is another "Variable" for the speed. # In Fortnite terms: This is like the "Storm Damage" setting. # It's a number we can tweak to make the game harder or easier. MoveSpeed: float = 5.0 # This is a "Function". # In Fortnite terms: This is like a "Device Trigger" that runs when the game starts. OnBegin(): void = # First, we need to find our target. # We look for a prop named "TargetProp" in the island. if (Prop := FindProp("TargetProp")): Target = Prop # Start the movement loop StartPatrol() else: # If we can't find the prop, print an error to the debug console. # Like getting a "Connection Lost" error. Print("Error: Could not find TargetProp!") # This function handles the movement logic. StartPatrol(): void = # Define the two points the target will visit. # These are "World Locations" (X, Y, Z coordinates). # Think of these as the "Set Start" and "Set Finish" positions. PointA := vector(0, 0, 200) PointB := vector(200, 0, 200) # This is a "While Loop". # In Fortnite terms: This is like a "Respawn Timer" that never ends. # It keeps running forever until we stop it. loop: # Move from A to B MoveTo(PointA, PointB) # Move from B to A MoveTo(PointB, PointA) # This function handles the actual movement between two points. MoveTo(From: vector, To: vector): void = # Check if the target actually exists before trying to move it. if (Target): # This is the "Magic Line". # It tells the prop to slide from 'From' to 'To' over time. # It uses "Ease" which means it starts slow, speeds up, then slows down. # Like a vehicle accelerating and braking. Target.MoveToEase(To, MoveSpeed, ease_type.Linear, animation_mode.OneShot) # Wait until the movement is finished before moving again. # Without this, the target would teleport instantly. # This is like waiting for the "Elimination" sound to finish before spawning the next wave. Wait(1.0 / MoveSpeed)