Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Как сделать бег в Roblox Studio?

SUPERCRINGE da Ученик (21), на голосовании 9 месяцев назад
как сделать что бы при нажатии на кнопку проигрывалась анимация а после 2с побежал персонаж сам, со скоростью 500 (например) (НЕ ИСПОЛЬЗУЙТЕ ИИ!!!) Roblox Studio
Голосование за лучший ответ
A.Ramshanov Знаток (499) 10 месяцев назад
Пробовали настроить макросы?
fairy yeah Профи (597) 10 месяцев назад
-- Скрипт для бега с задержкой

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Character:WaitForChild("Animator")
local RunningAnimation = Animator:LoadAnimation(script.Parent.RunningAnimation)
local StartRunningButton = script.Parent.StartRunningButton

-- Проверка на наличие персонажа
if Character then
-- Настройка анимации
RunningAnimation:Play()

-- Обработка ввода
Player.CharacterAdded:Connect(function(newCharacter)
Character = newCharacter
Humanoid = Character:WaitForChild("Humanoid")
Animator = Character:WaitForChild("Animator")
RunningAnimation = Animator:LoadAnimation(script.Parent.RunningAnimation)
end)

-- Обработка нажатия кнопки
StartRunningButton.MouseButton1Click:Connect(function()
-- Запуск анимации
RunningAnimation:Play()

-- Задержка 2 секунды
wait(2)

-- Запуск бега
Humanoid.WalkSpeed = 500
end)
end
Llll Delll Ученик (104) 6 месяцев назад
нужно создать локальный скрипт (LocalScript) и перенести его в StarterCharacterScripts. скрипт напишу ниже.
local NormalWalkSpeed = 20
local SprintSpeed = 30
local CameraEffect = true

local cas = game:GetService("ContextActionService")
local Leftc = Enum.KeyCode.LeftControl
local RightC = Enum.KeyCode.RightControl
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait(5)
local Humanoid = char:WaitForChild("Humanoid")

local Camera = game.Workspace.CurrentCamera
local TweenService = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(key, gameProcessed)
if gameProcessed then return end
if key.KeyCode == Enum.KeyCode.LeftShift then
if CameraEffect == true then
TweenService:Create(Camera, TweenInfo.new (0.5), {FieldOfView = 90}):Play()
end
Humanoid.WalkSpeed = SprintSpeed
end
end)

UIS.InputEnded:Connect(function(key, gameProcessed)
if gameProcessed then return end
if key.KeyCode == Enum.KeyCode.LeftShift then
if CameraEffect == true then
TweenService:Create(Camera, TweenInfo.new (0.5), {FieldOfView = 70}):Play()
end
Humanoid.WalkSpeed = NormalWalkSpeed
end
end)

--------------------------------------------------- Mobile Button

local function handleContext(Run, state, input)
if state == Enum.UserInputState.Begin then
if CameraEffect == true then
TweenService:Create(Camera, TweenInfo.new (0.5), {FieldOfView = 90}):Play()
end
Humanoid.WalkSpeed = SprintSpeed
else
if CameraEffect == true then
TweenService:Create(Camera, TweenInfo.new (0.5), {FieldOfView = 70}):Play()
end
Humanoid.WalkSpeed = NormalWalkSpeed
end
end

cas:BindAction("Run", handleContext, true, Leftc, RightC)
cas:SetPosition("Run", UDim2.new (.2, 0, .5, 0))
cas:SetTitle("Run", "Run")
cas:GetButton("Run").Size = UDim2.new (.3, 0, .3, 0)

Script by KittenDivinity
Георгий Петров Ученик (111) 1 месяц назад
Ввести данный скрипт:
local Mos = game.Players.LocalPlayer:GetMouse()
--Если нажата
Mos.KeyDown:connect(function(key)
if key:lower() == string.char(48) then
game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView + 1.6
local Player1 = game.Players.LocalPlayer.Character.Humanoid
if Player1 then
Player1.WalkSpeed = 25
end
end
end)
--Если отпущена
Mos.KeyUp:connect(function(key)
if key:lower() == string.char(48) then --Если нажата
game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView - 1.6
local Player1 = game.Players.LocalPlayer.Character.Humanoid
if Player1 then
Player1.WalkSpeed = 16
end
end
end)
через Starter Gui в local script-е
Олег Шадрин Ученик (126) 1 месяц назад
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then -- LeftShift можно поменять
humanoid.WalkSpeed = 32 -- Скорость игрока во время нажатия LeftShift
end
end)

UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then -- LeftShift можно поменять
humanoid.WalkSpeed = 16 -- скорость у игрока после отжимания клавиши Shift
end
end)

Как сделать так что бы работал скрипт:
1) Создать LocalScript в StarterCharacterScripts
2) Вставить этот код
Похожие вопросы