Where can I find source code for built-in functions?

  1. What do you want to achieve? Keep it simple and clear!
    Look at Humanoid:MoveTo() source code, and other built-in functions if possible.
  2. What is the issue? Include screenshots / videos if possible!
    Can’t find it.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve looked in GitHub - Roblox/Core-Scripts: All of ROBLOX's core client scripts. but did not find anything there. Also could not find any similar topics on the forums.
1 Like

For move to, Search google Humanoid:MoveTo() roblox and it’ll be there. First website on the page Humanoid | Roblox Creator Documentation contains everything you need

1 Like

No, he meant like actual code that run when u execute that function, so the internal core script for humanoid,

3 Likes

If you want to VIEW script inside studio, do this >

local Target =  -- // The script

print(Target.Source) -- // Prints the source code

-- // If source is 'table' then

or just double click the script, or check out this site >

// Developer.Roblox: Humanoid:MoveTo() //

1 Like

Upon further research, it seems that the implementation of built in functions cannot be accessed (probably for security reasons).

local human = Instance.new("Humanoid")
print(getmetatable(human))				-- locked
print(debug.getmetatable(human))		-- disabled
3 Likes

I mean to be fair if you found the roblox source online you could probably get the moveto function

From 2016:

static Reflection::BoundFuncDesc<Humanoid, void(Vector3, shared_ptr<Instance>)> func_MoveTo(&Humanoid::moveTo2, "MoveTo", "location", "part", shared_ptr<Instance>(), Security::None);

void Humanoid::moveTo2(Vector3 worldPosition, shared_ptr<Instance> part)
{
	PartInstance* p = Instance::fastDynamicCast<PartInstance>(part.get());
	moveTo(worldPosition, p);
}

void Humanoid::moveTo(const Vector3& worldPosition, PartInstance* part)
{
	// client side test here
    Vector3 local = worldPosition;
	if (part)
		local = part->getCoordinateFrame().pointToObjectSpace(worldPosition);

	walkToPoint = local + Vector3::unitX();	// will force replication
	walkToPart.reset();						// will force replication

	setWalkToPart(part);
    setWalkToPoint(local);
}

void Humanoid::setWalkMode(bool walking)
{
	if (TaskScheduler::singleton().isCyclicExecutive())
	{
		walking ? walkTimer = 8.0 : walkTimer = 0;
	}
	else
	{
		walking ? walkTimer = 240 : walkTimer = 0;
	}
	isWalking = walking;
}

void Humanoid::setWalkToPoint(const Vector3& value)
{
	{
		if (walkToPoint != value) {
			walkToPoint = value;
			raisePropertyChanged(propWalkToPoint);
		}

		setWalkMode(true);
	}
	// make sure we aren't moving according to a unit vector at the same time
	setLuaMoveDirection(Vector3(0,0,0));
}

void Humanoid::setWalkToPart(PartInstance* value)
{
	if (walkToPart.get() != value) {
		walkToPart = shared_from(value);
		raisePropertyChanged(propWalkToPart);
	}

	setWalkMode(isWalking);
}

It probably hasn’t changed much since then.

Note that this isn’t Lua, it’s C++.

2 Likes

I appreciate the effort, but do you have more of the code? Specifically the listener to

or

and if you could provide me with the source that would be great also.

That would be a method in Instance:

void Instance::raisePropertyChanged(const RBX::Reflection::PropertyDescriptor& descriptor)
{
    PropertyChanged event(RBX::Reflection::Property(descriptor, this));
    this->onPropertyChanged(descriptor);
    // security (This ensures the caller has a data model lock)
    if (this->parent && DFFlag::LockViolationInstanceCrash) // fast-path for replication and serialization
    {
        validateThreadAccess(this);
    }

    const PropertyChangedSignalData data(&descriptor);
    combinedSignal(PROPERTY_CHANGED, &data);
    propertyChangedSignal(&descriptor);
    if (getParent()!=NULL)
        getParent()->onChildChanged(this, event);
}

That just fires Lua signals (i.e. Humanoid.WalkToPoint).

No can do, unfortunately. I also can’t provide too many snippets here either as it’s proprietary code and confidential. My forum account could get deleted if I share too much.

What I can tell you is that there was a source code leak in the past. I can’t tell you how to get it or even that you should.

1 Like

Where can I find that Code? I really want It

Roblox’s monorepo was leaked in 2016, you can probably find a torrent that claims to have the “Roblox source code” and that is where I found that method.

Thanks!. I really appreciate your response. I have the full source code to a 2016 version of Roblox. Thanks lad!

1 Like