Roblox Studio - How to make Smooth Player Run Script
ฝัง
- เผยแพร่เมื่อ 6 ก.พ. 2025
- Script Below
-- Services --
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
-- Variables --
local Player = game.Players.LocalPlayer
local HUM = Player.Character:FindFirstChild("Humanoid")
-- Settings --
local RunSpeed = 30
local BaseSpeed = 16
local TransitionTime = 2
local Key = "LeftShift"
-- Script --
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode[Key] then
TS:Create(HUM, TweenInfo.new(TransitionTime), {WalkSpeed = RunSpeed}):Play()
end
end)
UIS.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode[Key] then
TS:Create(HUM, TweenInfo.new(TransitionTime), {WalkSpeed = BaseSpeed}):Play()
end
end)