Here are my issues:
- Network ownership seems to be reverted back to normal like if i didn’t change anything, so the ownership changes to client and server (it’s singleplayer)
- Pathfinding feels way too smooth, like it takes a while to turn which makes it easy to juke and it just looks odd
- It sometimes just stops if it tried getting through a gap it should be able to go through, moving to the other side fixes it
- Even though the script is disabled on start, the script will still fire the remote, making the text appear and an error appear (the scripts of the chapter are cloned and the old ones are deleted to fully restarts them)
- And if you go downstairs (the stairs are pretty narrow but they seemed to work before)
humanoid:MoveTo(waypoints[waypointindex].Position)
errors with “Attempt to index nil with ‘Position’”
sorry for all the trouble lol
here’s the code:
local anim = script.Parent.Humanoid:LoadAnimation(script.Parent.Stun)
anim:Play()
task.wait(25)
anim:Stop()
game.ReplicatedStorage.Awaken:FireAllClients()
local pfs = game:GetService("PathfindingService")
local pathparams = {
["AgentHeight"] = 6,
["AgentRadius"] = 0.7,
["AgentCanJump"] = true,
["AgentCanClimb"] = false,
["WaypointSpacing"] = math.huge
}
local waypoints = {}
local waypointindex = 1
local torso = script.Parent:WaitForChild("Torso")
local humanoid = script.Parent:WaitForChild("Humanoid")
local root = script.Parent:WaitForChild("HumanoidRootPart")
local anim = script.Parent.JumpscareAnimation
local animation = humanoid:LoadAnimation(anim)
local plrhumanoid
for _, plr in pairs(game.Players:GetPlayers()) do
plrhumanoid = plr.Character.HumanoidRootPart
script.Parent.PrimaryPart:SetNetworkOwner(plr)
end
root.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
for _, parts in pairs (plr.Character:GetChildren()) do
if not parts:IsA("Humanoid") and parts.Name ~= "HumanoidRootPart" then
parts:Destroy()
end
end
plr.Character:WaitForChild("Humanoid"):TakeDamage(100)
root.CanTouch = false
humanoid.WalkSpeed = 0
plrhumanoid.Anchored = true
plrhumanoid.Parent.Humanoid.WalkSpeed = 0
script.Parent.Camera1.Anchored = true
game.ReplicatedStorage.CameraFall:FireAllClients(script.Parent)
game.ReplicatedStorage.PlayJumpscare.OnServerEvent:Connect(function()
script.Parent.HumanoidRootPart.Jumpscare:Play()
script.Parent.HumanoidRootPart.UneasyUrgency:Stop()
animation:Play()
task.delay(0.5, function()
root.HitSound:Play()
task.wait(0.5)
root.HitSound:Play()
task.wait(0.4)
root.HitSound:Play()
end)
end)
animation.Stopped:Connect(function()
game.ReplicatedStorage.CameraFall2:FireAllClients(script.Parent)
end)
end
end)
local path
local function Walk()
if plrhumanoid == nil then
return
end
path = pfs:CreatePath(pathparams)
path:ComputeAsync(torso.Position, plrhumanoid.Position)
local waypoints = path:GetWaypoints()
waypointindex = 2
humanoid:MoveTo(waypoints[waypointindex].Position)
end
task.spawn(function()
while task.wait() do
Walk()
end
end)