Hey, so I want to make a remote event where I can just move an NPC, this is the script
local Helza = game.Workspace.Helza
local WalkAnim = Instance.new("Animation")
WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=5319844329"
local HelzaMoveEvent = game.ReplicatedStorage.Remotes.HelzaMoveEvent
local controller = Helza.Humanoid
HelzaMoveEvent.OnClientEvent:Connect(function(EndPosition)
while Helza.HumanoidRootPart.Position ~= EndPosition do
controller:LoadAnimation(WalkAnim):Play()
Helza.Humanoid:MoveTo(EndPosition)
end
controller:LoadAnimation(WalkAnim):Stop()
end)
end)
But when I do that, my roblox studio just crash and become not responding
does the MoveTo() function need to be in the while loop same with playing the animation just make the animation loop and only play it before the while loop
They behave similarly, their core definitions are different and :wait() is deprecated, :Wait() is the up to date variant and should be used instead.
The same applies for any deprecated instance method and its contemporary variant, consider :clone() and :Clone() for example, or :remove() and :Destroy().