[](http://)Is this the right location for trying to sort out a players walk speed? Thanks in advance.
alright so here is the function and here is what I want to execute. I put in Bold what I want to be highlighted.
local player = game.Players.LocalPlayer local RunService = game:GetService("RunService") local ContextActionService = game:GetService("ContextActionService")
*******local playerSpeed = game.Workspace.Player.Humanoid.WalkSpeed*******
local newWalkSpeed = 15 local jumping = false local leftValue, rightValue = 0, 0 local SpeedBoostValue = 0
local function onLeft(actionName,inputState) if inputState == Enum.UserInputState.Begin then leftValue = 1 else if inputState == Enum.UserState.End then rightValue = 0 end end end
local function onRight(actionName,inputState) if inputState == Enum.UserInputState.Begin then leftValue = 1 else if inputState == Enum.UserState.End then rightValue = 0 end
end
end
local function onJump(actionName,inputState) if inputState == Enum.UserInputState.Begin then leftValue = 1 else if inputState == Enum.UserState.End then rightValue = 0 end end
end
local function onSpeedBoost(actionName,inputState) if inputState == Enum.UserInputState.Begin then SpeedBoostValue = 1 else if inputState == Enum.UserState.End then SpeedBoostValue = 0 end
end **** *********if playerSpeed < 16 and playerSpeed > 30 then newWalkSpeed = playerSpeed + newWalkSpeed playerSpeed = newWalkSpeed ************* end
end local function onUpdate() if player.Character and player.Character:FindFirstChild("Humanoid") then if jumping then player.Character.Humanoid.Jump = true end local moveDirection = rightValue - leftValue player.Character.Humanoid:Move(Vector3.new(moveDirection,0,0), false) end
end
RunService:BindToRenderStep("Control", Enum.RenderPriority.Input.Value, onUpdate)
ContextActionService:BindAction("Left", onLeft, true, "a", Enum.KeyCode.Left, Enum.KeyCode.DPadLeft) ContextActionService:BindAction("Right", onRight, true, "d", Enum.KeyCode.Right, Enum.KeyCode.DPadRight) ContextActionService:BindAction("Jump", onLeft, true, "w", Enum.KeyCode.Space, Enum.KeyCode.Up, Enum.KeyCode.DPadUp, Enum.KeyCode.ButtonA) **********ContextActionService:BindAction("SpeedBoost", onSpeedBoost, true, "c", Enum.KeyCode.r)

6 comments
I'm not sure what you mean by "sort out" but yes, that is the Studs per second that that specific Character moves at.
Im trying to find where the WalkSpeed is located so that I can change it with the action of a button.
Your question is very vague, and so is your above comment; perhaps you could give us a bit more insight on what exactly you are trying to do. A code snippet would be wonderful :)
It's a very long code but I will post it. Sorry I'm not being as understanding.
Sorry for the sloppiness, this is my first time posting and using the website.
Would you mind wrapping the code in an lua wrapper?