Click to send me a friend request or message me on Discord.
Rickroll Video 1
-- Luau code
-- Services
local PathfindingService = game:GetService('PathfindingService')
-- Variable declerations
local TargetPart = workspace:FindFirstChild('Target')
local Agent = workspace:FindFirstChild('Rig')
local Humanoid = Agent:FindFirstChild('Humanoid')
assert(Humanoid, 'No valid humanoid for agent')
-- Functions
local NewPath = function()
return PathfindingService:CreatePath({
AgentCanJump = true,
Costs = {['Lava'] = 10000}
})
end
local MoveTo = function(Position : Vector3) : RBXScriptSignal
Humanoid:MoveTo(Position)
return Humanoid.MoveToFinished
end
-- Lava bricks
local Lava = workspace:FindFirstChild('Lava'):GetChildren()
table.foreach(Lava, function(Index)
Lava[Index].Touched:Connect(function(Hit : BasePart)
if Hit.Parent == Agent then
Humanoid.Health = 0
end
end)
end)
-- Main
local Path = NewPath()
local Goal = TargetPart.Position
Path:ComputeAsync(Agent.HumanoidRootPart.Position, Goal)
if not Path:GetWaypoints() then
error('Failed to resolve path', 1)
end
local Waypoints = Path:GetWaypoints()
for Index, Waypoint : PathWaypoint in ipairs(Waypoints) do
local WaypointPosition = Waypoint.Position
local MoveToFinished = MoveTo(WaypointPosition)
if Waypoint.Action == Enum.PathWaypointAction.Jump then
Humanoid.Jump = true
end
MoveToFinished:Wait()
end
Rickroll Video 2
-- Example Luau code
for i = 1, 5 do
print("Loop "..i)
end