Make an object move using player's directional buttons

ok so i put them in starter character scripts and they don’t work.

this part is a local script and the one below is a server script right?

edit: i just have to define the part right?

So I already put it in the script and to change it you would need to either add to the value or change the players jump power

ok but where do i put that line in the script? and how do i define “JumpPower”

JumpPower is a property of the Humanoid.
https://create.roblox.com/docs/reference/engine/classes/Humanoid#JumpPower

Jump Power would be located in the player’s character’s humanoid. Also you can place that anywhere

so this should be the script completed?

local thisPlayer = game.Players.LocalPlayer --get the player

local playerScripts = thisPlayer:WaitForChild(“PlayerScripts”) --wait for the player scripts
local playerModule = require(playerScripts:WaitForChild(“PlayerModule”)) – wait for the player module

local movementController = playerModule:GetControls() – get the movement controller

movementController.moveFunction = function(player, direction, relative) – movement controller for player
thisPlayer.Move(player, direction, relative) – will move the player
workspace.part.Position += direction --replace part with the part you want to move and this will just move the part the same direction as the player
end

local JumpPower = thisPlayer.Character.Humanoid
h = (JumpPower ^ 2) / (2 * workspace.Gravity)

local Char = thisPlayer.Character or thisPlayer.CharacterAdded:Wait()

Char.Humanoid.StateEnabledChanged:Connect(function(state,enabled)
if state == Enum.HumanoidStateType.Jumping then
if enabled == true then
workspace.part.Position += Vector3.new(0,(Char.Humanoid.JumpPower^ 2) / (2 * workspace.Gravity),0)
elseif enabled == false then
workspace.part.Position -= Vector3.new(0,(Char.Humanoid.JumpPower^ 2) / (2 * workspace.Gravity),0)
end
end
end)

1 Like

Yep exactly like that

type or paste code here

it works except for the jumping part. is there any way to change the orientation of the part basing on the direction, too? i also didn’t understand how to change the speed sorry :sweat_smile:

Have you got a video you can share of what happens?

no it works but when i click ‘space’ i just doesn’t do nothing

hi have you got a solution? sorryy haha