#NPC not Firing Event

72 messages · Page 1 of 1 (latest)

peak owl
#

For some reason npc wont fire DemoFinished:Fire(); instead i get an error

#

its not line 13 that was for debugging

#

line 84

wild pasture
#

-- Ensure NPC ownership is set to the server
script.Parent.HumanoidRootPart:SetNetworkOwner(nil)

-- Services
local pfs = game:GetService("PathfindingService")
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")

-- NPC and related assets
local NPC = script.Parent
local humanoid = NPC:FindFirstChildOfClass("Humanoid")
local AnimScript = NPC:WaitForChild("Animation")

-- Remote Events and Bindable Events
local Demotrigger = RS:WaitForChild("Demotrigger")
local DemoFinished = RS:WaitForChild("DemoFinished")

-- Waypoints
local waypoints = {
D1 = workspace:WaitForChild("Demopoint1"),
D2 = workspace:WaitForChild("Demopoint2"),
D3 = workspace:WaitForChild("Demopoint3"),
D4 = workspace:WaitForChild("Demopoint4"),
D5 = workspace:WaitForChild("Demopoint5"),
D6 = workspace:WaitForChild("Demopoint6"),
D7 = workspace:WaitForChild("Demopoint7"),
}

-- Animation
local CatchAnim = Instance.new("Animation")
CatchAnim.AnimationId = "rbxassetid://101600395499791"
local loadedAnimation = humanoid:LoadAnimation(CatchAnim)

-- Function to move the NPC to a point
local function moveToPoint(point)
local path = pfs:CreatePath({
AgentRadius = 2,
AgentHeight = 5,
AgentCanJump = true,
AgentJumpHeight = 5,
AgentMaxSlope = 45
})

path:ComputeAsync(NPC.PrimaryPart.Position, point.Position)

if path.Status == Enum.PathStatus.Complete then
    for _, waypoint in ipairs(path:GetWaypoints()) do
        NPC.Humanoid:MoveTo(waypoint.Position)
#

NPC.Humanoid.MoveToFinished:Wait()
end
else
warn("Pathfinding failed to compute a path.")
end
end

-- Function to handle NPC movement sequence
local function handleNPCMovement()
-- Disable idle animations
AnimScript.Enabled = false

-- Play custom animation
loadedAnimation:Play()

-- Move to each point in sequence
local movementSequence = {
    {waypoints.D1, 2},
    {waypoints.D2, 2},
    {waypoints.D3, 2},
    {waypoints.D4, 2},
    {waypoints.D5, 2},
    {waypoints.D6, 2},
    {waypoints.D7, 2},
}

for _, data in ipairs(movementSequence) do
    moveToPoint(data[1])
    wait(data[2]) -- Wait for a given time
end

-- Stop animation and re-enable idle animations
loadedAnimation:Stop()
AnimScript.Enabled = true

end

-- Connect Demotrigger event
Demotrigger.OnServerEvent:Connect(function()
print("Demotrigger activated!")
handleNPCMovement()
DemoFinished:Fire()
end)

#

@peak owl I fixed some things try this

peak owl
#

alr

#

now i get errors on a whole bunch of other lines

#

thanks for trying i guess

#

im a begginer

#

@wild pasture

wild pasture
#

Copy those errors and send em to me

peak owl
#

i fucking hate lua

#

i fucking hate roblox

#

this platform is shit

#

even if i made the game and finished it would it even get popular

#

all they care about is these shit brainrot games

wild pasture
#

what

wild pasture
peak owl
#

not anymore

#

im done

wild pasture
wild pasture
peak owl
sullen whale
#

kids oddly enjoy creepypasta games

wild pasture
#

show it ur code and the errors u get

peak owl
wild pasture
wild pasture
peak owl
#

I DID

wild pasture
#

it gives out a solid answer

#

what did it say

peak owl
#

SO MANY TIMES

wild pasture
#

What’s it say

peak owl
#

"Lets Debug. First Add 1000000000000000000 print("Bull Shit")"

wild pasture
#

fix it

wild pasture
peak owl
#

dude forget it

#

ok fine

#

wait

sullen whale
#

if not NPC.Humanoid.MoveToFinished then this is malformed

peak owl
#

nvm this projects a waist of time

wild pasture
sullen whale
#

its an event on the previous line NPC.Humanoid.MoveToFinished:Wait()

wild pasture
peak owl
#

how do i close this post

sullen whale
#

so the condition says if not event then which will never pass

wild pasture
sullen whale
wild pasture
sullen whale
#

it comes at night

#

it's a clone of color or die / lights out with a different gimmick

wild pasture
#

what’s the name tho

#

lemme check it out

sullen whale
wild pasture
#

ok

#

Can’t find it

sullen whale
#

interesting it doesnt show in search i can just link you in dm if u want

arctic hazel
peak owl
arctic hazel
#

no idea

peak owl
#

thought i closed it already

wild pasture