Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to add the shift command for sprint...?

Asked by 6 years ago

and how to make a trail?

0
You mean Shift to Sprint? Qawstar 32 — 6y
0
ScriptingHelpers is not a requesting website. https://scriptinghelpers.org/help/how-post-good-questions-answers xJathur95x 129 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Sir, this is not requesting website. But i can teach you how to make it.

First: Found keycode.
You need to found what keys does the player input.
Then you can use this code.

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode."TheKeyCode" then
        --Make what you want.
    end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)

Remember to change "TheKeyCode" to LeftShift.
This code means when you pressed TheKeyCode, then Make what you want. will happen.

Second: Found player's moving speed.
It's time to speed up your character!
Then you need to found your character first.

local Player = game:GetService('Players').LocalPlayer --This means found "Player", but not Character yet!
local FakeCharacter = Player.Character or Player.CharacterAdded:Wait() --Means found "Character", still not real character...
local Character = FakeCharacter:WaitForChild('Humanoid') --This is real character, It's Humanoid.

We found all Character now! Now we need to found Player's speed.
The player has a lot of valid member, we only need his WalkSpeed.

Character.WalkSpeed = 16
--WalkSpeed is in the Humanoid, the original speed is 16(Means 16 studs every 1 seconds.)
--you can choose any speed you want.

third: Mix them.
Maybe you can do it by your self! Don't be a dumb. :)
Just put Second code in to the First code. Hope you enjoy learning Lua!
Reference Video:From Youtube

0
Actually, the speed is 16 studs/s, not 16 studs/10s User#19524 175 — 6y
0
i search that from wiki. xD Thank for correct! MEndermanM 73 — 6y
Ad

Answer this question