📌  相关文章
📜  如何制作一个正在运行的系统 roblox - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:52.561000             🧑  作者: Mango

代码示例1
local Left = Enum.KeyCode.LeftShift
local Right = Enum.KeyCode.RightShift

local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")

local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")

local OriginalSpeed = Humanoid.WalkSpeed
local Multiplication = 2.5
local InfoSpeed = 3
local SprintingSpeed = OriginalSpeed * Multiplication

local Info = TweenInfo.new(InfoSpeed)

local EditingWalk = {WalkSpeed = OriginalSpeed}
local EditingSprint = {WalkSpeed = SprintingSpeed}

UIS.InputBegan:Connect(function(Key, Chatting)
    if Chatting then return end
    if Key.KeyCode == Left or Key.KeyCode == Right then
        TS:Create(Humanoid, Info, EditingSprint):Play()
    end
end)

UIS.InputEnded:Connect(function(Key, Chatting)
    if Chatting then return end
    if Key.KeyCode == Left or Key.KeyCode == Right then
        TS:Create(Humanoid, Info, EditingWalk):Play()
    end
end)