#NPC not Firing Event
72 messages · Page 1 of 1 (latest)
-- 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
alr
now i get errors on a whole bunch of other lines
thanks for trying i guess
im a begginer
@wild pasture
Not bad I’ll look
Copy those errors and send em to me
Forget it
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
That is the game about
what
Fax
it WAS about a creepy ass store that had a real good story and shit
not anymore
im done
What’s the plot of the game tho what happens in it
Nah don’t quit usally this types of games get a lot of players
the store owner is hiding somthing you go fine out what thats it
kids oddly enjoy creepypasta games
Have u tried using chat gbt
show it ur code and the errors u get
the code i sent you was 90 percent chatgpt
Oh
Copy the errors and ask it
I DID
SO MANY TIMES
What’s it say
"Lets Debug. First Add 1000000000000000000 print("Bull Shit")"
Bro if it finds a problem in ur script then that’s the problem
fix it
Can u add me to ur game lemme check it out
if not NPC.Humanoid.MoveToFinished then this is malformed
nvm this projects a waist of time
This is the guy right here🔥
its an event on the previous line NPC.Humanoid.MoveToFinished:Wait()
Just add me lemme check it out
how do i close this post
so the condition says if not event then which will never pass
Bro do u have any games of ur own?
ye
What’s it called
it comes at night
it's a clone of color or die / lights out with a different gimmick
this is the name
interesting it doesnt show in search i can just link you in dm if u want
Sure
your mindset is whats stopping that from happening yk
how tf do i close this
no idea
thought i closed it already
is that u in ur pfp because mmmmmmmmmmmmmm