As seen in the video above, anything can make the Box teleport to a position.
I want to modify my code so only Humanoid can make the box teleport to a position.
local Box = game.Workspace.box
local Door = script.Parent
Door.Touched:Connect(function()
Box.Position = Vector3.new(-127, 20, -145)
end)
Correct me if i’m wrong but if someone (say, an exploiter) changed the name of the Humanoid instance to something else wouldn’t the script not work?
It is possible if it’s a local script. :FindFirstChild only searches for the .Name for each object under the Instance you index to.
Alternatively, you can loop inside of the character and use :IsA to see if the Class is a Humanoid.
Possibly. Instead of using :FindFirstChild() you can use :FindFirstChildWhichIsA() or :FindFirstChildOfClass() to find a Humanoid object (by ClassName) inside of the character, regardless of the Humanoid’s actual Name.