I apologize in advance for butchering my question, but what I'm pretty much trying to do is 'transfer', or replicate, default character controls into another model that has a humanoid (meaning 'W' will move the model forward depending on the direction the camera is facing, 'D' will move the model backwards, etc.)
There was a Wiki article explaining how to create and manipulate player movement that I found useful and helped provide a starting point for me. The article can be found here.
What I have so far works pretty well, but it's not what I want. Here's the code I've taken from the Wiki, and edited so it works alongside what I have at the moment;
--// Script provided by the ROBLOX Wiki local userInputService = game:GetService("UserInputService") local runService = game:GetService("RunService") local player = game.Players.LocalPlayer local moveVector = Vector3.new(0,0,0) userInputService.InputBegan:connect(function(inputObject) local poke = workspace:FindFirstChild(player.Name.."'s Pokemon") if poke then if inputObject.KeyCode == Enum.KeyCode.A then moveVector = moveVector + Vector3.new(1,0,0) end if inputObject.KeyCode == Enum.KeyCode.D then moveVector = moveVector + Vector3.new(-1,0,0) end if inputObject.KeyCode == Enum.KeyCode.Space then poke.Humanoid.Jump = true end end end) userInputService.InputEnded:connect(function(inputObject) local poke = workspace:FindFirstChild(player.Name.."'s Pokemon") if poke then if inputObject.KeyCode == Enum.KeyCode.A then moveVector = moveVector + Vector3.new(-1,0,0) end if inputObject.KeyCode == Enum.KeyCode.D then moveVector = moveVector + Vector3.new(1,0,0) end end end) runService.RenderStepped:connect(function() local poke = workspace:FindFirstChild(player.Name.."'s Pokemon") if poke then poke.Humanoid:Move(moveVector) end end)
Here's a GIF showing how the code works in-game so far; Link
As you can tell within the script and GIF, the controls don't function exactly like the default controls- which is where I need some assistance. Upon pressing A or D, the model will only move relative to the world space, not the model's position or the direction of the camera.
I've worked with Lua for a while now, but this is certainly one of the things that continue to puzzle me no matter how hard I try to attempt it.
What would I need to do in order to accomplish the task I'm trying to complete? Or is there a much easier solution around this problem?
I don't necessarily need a definite answer, but I'd appreciate any general tips that could lead me to the correct path. Thanks!
Sorry for a late answer, but I'm mostly answering this for anyone else that needs help with this.
Perci1 was essentially correct about his solution, but he made a tiny mistake. Set the LocalPlayer's Character to the model of the target character. When you are finished controlling that character, set it back to the old model. Perhaps something like this:
local Player = game.Players.LocalPlayer local CachedCharacter = Player.Character local Pokemon = --[[whatever your pokemon is]] function ControlPokemon() Player.Character = Pokemon end function ControlSelf() Player.Character = CachedCharacter end
If the camera does not move to the Pokemon, you may have to set CurrentCamera's CameraSubject property to the Pokemon when you change, and vice versa with the regular character.