Alright I have a script that gives the controls of the character to a model, sad thing is that I got the model moving and such, just not the right away. The controls ignores which way the camera is facing and just move in the direction that was set. (Forwards means going only 0,0,1 etc. etc.)
Here is the script that does the moving (and sets up the camera)
local player = game.Players.LocalPlayer
local char = player.Character
local camera = game.Workspace.CurrentCamera
local BeastM = game.ReplicatedStorage.Titans["Beast Titan"].Beast
BeastM.Parent = workspace
camera.CameraSubject = BeastM["Head"]
camera.CameraType = "Follow"
local player = game.Players.LocalPlayer
local RunService = game:GetService('RunService')
local ContextActionService = game:GetService('ContextActionService')
local jumping = false
local leftValue, rightValue, forwardValue, backwardValue = 0, 0, 0, 0
local function moveRightFunc (actionName, inputState)
if inputState == Enum.UserInputState.Begin then
rightValue = 1
elseif inputState == Enum.UserInputState.End then
rightValue = 0
end
end
local function moveLeftFunc(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
leftValue = 1
elseif inputState == Enum.UserInputState.End then
leftValue = 0
end
end
local function moveForwardFunc (actionName, inputState)
if inputState == Enum.UserInputState.Begin then
forwardValue = 1
elseif inputState == Enum.UserInputState.End then
forwardValue = 0
end
end
local function moveBackwardFunc (actionName, inputState)
if inputState == Enum.UserInputState.Begin then
backwardValue = 1
elseif inputState == Enum.UserInputState.End then
backwardValue = 0
end
end
local function jumpFunc (actionName, inputState)
if inputState == Enum.UserInputState.Begin then
jumping = true
elseif inputState == Enum.UserInputState.End then
jumping = false
end
end
local function onUpdate()
if BeastM and BeastM:FindFirstChild('Humanoid') then
if jumping then
BeastM.Humanoid.Jump = true
end
local moveDirection = rightValue - leftValue
local OtherDirection = forwardValue - backwardValue
BeastM.Humanoid:Move(Vector3.new(moveDirection,0,OtherDirection), false)
end
end
RunService:BindToRenderStep('Control', Enum.RenderPriority.Input.Value, onUpdate)
ContextActionService:BindActionToInputTypes("forwardMovement", moveForwardFunc, false, Enum.PlayerActions.CharacterForward)
ContextActionService:BindActionToInputTypes("backwardMovement", moveBackwardFunc, false, Enum.PlayerActions.CharacterBackward)
ContextActionService:BindActionToInputTypes("leftMovement", moveLeftFunc, false, Enum.PlayerActions.CharacterLeft)
ContextActionService:BindActionToInputTypes("rightMovement", moveRightFunc, false, Enum.PlayerActions.CharacterRight)
ContextActionService:BindActionToInputTypes("jumpAction", jumpFunc, false, Enum.PlayerActions.CharacterJump)
end
Here is the GIF of what its doing in game:
https://gyazo.com/481ed7a6e54bc2dcfb5b53de3ae91af0
Also, I can't put the model into startercharacter as I do not want the character to be set to the Model on spawn plus I want the old character to be accessible.
Also, Setting the model as the player's character does not work.
