You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
My script is a pathfinding scripting that can kick down doors -
What is the issue? Include screenshots / videos if possible!
This script has worked for over a month.However, yesterday it suddenly stopped working -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried to look in theupdate logs but there are no changes that i did not
local pathfindingService = game:GetService("PathfindingService")
local zombie = script.Parent
local HumanoidRootPart = zombie:WaitForChild("HumanoidRootPart")
local Humanoid = zombie:WaitForChild("Humanoid")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local nearestPlayer
local PlayerFoundEvent = zombie.PlayerFound
local nextWaypoint = 2
local pathFound = false
PlayerFoundEvent.OnServerEvent:Connect(function(player)
nearestPlayer = player
end)
repeat task.wait() until nearestPlayer ~= nil
function ComputePath()
if nearestPlayer then
local path: Path = pathfindingService:CreatePath({AgentCanJump = true; Costs = {Water = 10, OpenDoor = 1}})
local success, errorMessage = pcall(function()
path:ComputeAsync(HumanoidRootPart.Position, nearestPlayer.Character.PrimaryPart.Position)
computed = true
end)
if success then
local waypoints = path:GetWaypoints()
for i, v: PathWaypoint in pairs(waypoints) do
if v.Label == "OpenDoor" then
local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Exclude
overlapParams.FilterDescendantsInstances = {zombie}
local place = workspace:GetPartBoundsInRadius(zombie.PrimaryPart.CFrame.Position,6,overlapParams)
for i, v in place do
if v.Parent.Name == "Door" then
local base = v.Parent.Base
local hinge = base.Parent.Doorframe.Hinge
local prompt = base.ProximityPrompt
local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(180), 0)
local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)
local tweenInfo = TweenInfo.new(1)
local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
if prompt.ActionText == "Open" then
print("Open")
tweenOpen:Play()
prompt.ActionText = "Close"
v.Parent:SetAttribute("Open",true)
base.CanCollide = false
base.Union.CanCollide = false
end
end
end
end
Humanoid:MoveTo(v.Position)
nextWaypoint += 1
end
end
if not success then
warn(errorMessage)
end
Humanoid.MoveToFinished:Wait()
computed = false
if computed ~= false then return end
ComputePath()
end
end
ComputePath()
What is the problem?