#Script to move rig/npc to a location
1 messages · Page 1 of 1 (latest)
this is a script on a remote event i want this script to teleport the npc to a location orientation i could figure out after
When is not a valid keyword. Did you mean if?
yes
** You are now Level 3! **
the OnServerEvent of the RemoteEvent is a callback that always gives you the player
remoteEvent.OnServerEvent:Connect(function(player, <other params>)
local char = player.Character
local humanoid = char.Humanoid
humanoid:MoveTo(<position>)
-- Or you can teleport the whole model
char:MoveTo(<position>)
end)
how would i do this but for any rig/npc
If the event is within the NPC
npc.RemoteEvent.OnServerEvent:Connect(function()
npc.Humanoid:MoveTo(<position>)
-- To teleport
npc:MoveTo(<position>)
end)
If the event is elsewhere
-- Client
remoteEvent:FireServer(npcModel)
-- Server
remoteEvent.OnServerEvent:Connect(function(playerWhoFired, npcModel)
npcModel.Humanoid:MoveTo(<position>)
-- To teleport
npcModel:MoveTo(<position>)
end)
Does that make sense?
lol alright