#How to get the position of a Model?

1 messages · Page 1 of 1 (latest)

cold jacinth
#

Hii y'all
I'm trying to get the distance from a model to a part. How would I get the position of a model?

prime steeple
#

If your model has a PrimaryPart then its best to use that parts position

cold jacinth
#

Oh and also @prime steeple

#

I am trying to make a humanoid move to my waypoints in order from 1 to end

#

I have them as childs in order and all but when I use a loop with getchildren they give a table with non ordere children meaning rn my npc just goes to a random order

#

how can I make it follow it correctly?
Tried to use table.sort and all but just doesnt really work

prime steeple
prime steeple
cold jacinth
#

but the rest is on number

prime steeple
#

so 1 is the 2nd?

cold jacinth
#

no no

#

the 2nd is called 2

#

start, 2, 3, 4 etc, end

prime steeple
#

so what is start and end then

#

what is 1 then

cold jacinth
#

first and last

#

nothing

#

the names go; start, 2, 3, 4, 5, end

prime steeple
#

is it important that they are named start and end?

cold jacinth
#

nah

#

just so my ADHD brain can connect the dots

prime steeple
#

Rename them to 1 2 3 4 5 6

cold jacinth
#

okidoki
then what? 😅

prime steeple
#

Hold up let me look into one of my old scripts i had the same problem

cold jacinth
#

Why is it that getchildren will give a shuffled table?

prime steeple
#

So basicly I just had a function which would get the next waypoint based on a current waypoint variable

cold jacinth
#

thats like so not efficient

prime steeple
cold jacinth
#

as making a whole function for that sounds like overkill

#

imo

prime steeple
cold jacinth
prime steeple
#

I have a variable CurrentPathpoint which could be 1 for example

cold jacinth
prime steeple
#

So i loop through each pathpoint look if its name is tostring(CurrentPathpoint + 1)

#

and return that Pathpoint

#

Does that help?

cold jacinth
#

cuz you use tostring-tonumber

#

so you get a numered string

prime steeple
#

Because thats what i needed

cold jacinth
prime steeple
#

but the function itself returns the instance

cold jacinth
#

then you go through the entire table and look when that path matches the name and return the path thinguy

#

I think I understand it

#

thanks 😄

prime steeple
#

👍

cold jacinth
prime steeple
cold jacinth
#

oh oke

#

but ur not using it tho

prime steeple
#

People always do "_" because they don't need the index

prime steeple
cold jacinth
#

using a while loop to continue walking until the end

prime steeple
#

Looks good

cold jacinth
#

Btw I have a question

#

When you place something in a storage, replicated or server, they don’t get rendered

#

What if I have a script in there?(as in one of the models in storage) Does this script also get run on the model in storage or only on the cloned ones?

#

@prime steeple

cold jacinth
#

Oh and is it possible for one script to call a function on another script?

prime steeple
prime steeple
#

Nvm. I remembered. A script in storage will run once its removed from storage

cold jacinth
scarlet marshBOT
#

studio** You are now Level 8! **studio

acoustic seal