#Zombie not moving

1 messages · Page 1 of 1 (latest)

opaque kelp
#

local script inside the zombie

local runService = game:GetService("RunService")
local zombietorso = script.Parent.Torso
    
while true do
    wait()
    local aggro = 50
    for _, v in pairs(game.Players:GetChildren()) do
        local character = v.Character
        if character and character.Humanoid then
            local torso = character.Torso
            if torso then
                local distance = (zombietorso.Position - torso.Position).Magnitude
                if distance < aggro then
                    script.Parent.Humanoid:MoveTo(torso.Position)
                end
            end
        else
            script.Parent.Humanoid.Health -= script.Parent.Humanoid.MaxHealth
        end
    end
end
remote marsh
remote marsh
#

yeah just make sure its not dead

opaque kelp
#

it isnt

remote marsh
#

add some prints to debug

opaque kelp
#

local script

remote marsh
#

add some prints

#

to debug

#

if one of the if statements is failing

#

also dont go by the torso

#

use the HumanoidRootPart

opaque kelp
#

still doesnt work

remote marsh
#

it seems like you want to be told how to do it instead of learning

#

tsk tsk tsk

opaque kelp
#

i guess i need to use pathfind and not moveto but im not learning pathfind rn

opaque kelp
remote marsh
#

are u sure the script is even running

#

maybe try putting it in a regular script

#

and see if it works

#

there is a reason why i said add prints

opaque kelp
#

but ill try i guess

remote marsh
balmy sierra
#

...

opaque kelp
#

u cant

balmy sierra
#

@opaque kelp

#

u can

#

but use a serverscript for this

opaque kelp
#

I mean handling the character

balmy sierra
#

@opaque kelp

#

What?

#

I don't understand

opaque kelp
balmy sierra
#

Ye

#

Use a server

balmy sierra
tepid shard
# opaque kelp It was a local script inside the zombie

Local scripts won't run inside of objects in the workspace. Also, local scripts are for client-sided scripting, which I recommend looking up the difference between client and server online, it'll save you some trouble

opaque kelp
tiny terraceBOT
#

studio** You are now Level 5! **studio

opaque kelp
#

Only players

tepid shard
#

It's just things running on a local script won't replicate to the server naturally

#

Excluding certain cases

tepid shard
#

What

opaque kelp
#

because when i did tool.activate it played a animation that the server saw

tepid shard
#

It's not that tools do it, but how the players character interacts with local scripts

#

The player character is among the exceptions I was talking about. Things like playing an animation and moving the characters position on the client are automatically replicated to the server

opaque kelp
#

since your moving the character

tepid shard
opaque kelp
#

oooh

tepid shard
#

Well, there's also network ownership, but you can probably get away with ignoring that for a while

balmy sierra
#

@opaque kelp

#

local is what u see

#

server is what everyone else sees

#

please learn scripting

sudden trellis
#

can someone help me

balmy sierra
opaque kelp
#

I know local is what the player sees

#

And server is the server

#

I just thought local scripts can also be applied to rigs

opaque kelp
balmy sierra
#

@opaque kelp

#

Then. you would understand that only you would see it

opaque kelp
balmy sierra
#

Yea

#

@opaque kelp

#

But thats only for movement of hrp and anims

#

Why do you have to use local again?