#animation

1 messages · Page 1 of 1 (latest)

unborn zenith
#

So I have a run animation and I want to use it in my game, I'm a complete noob in roblox scripting but I know my way around other languages. I kinda just need the general basics of how to do it because I have other animations to add.

I want to figure out a WASD walk animation script and the a WW to sprint script. And IDLE animation scripts. I would appreciate it very much for any help! Thanks!

sand island
#

didnt test it but hope it works (only made the run thing)

-- put this code in a local script, insert into starter player > starter player
--scripts.
local first_step = false -- create variable and set to false
local running_ = false -- make variable and set to false
-- fires when the player presses any key
game.UserInputService.InputBegan:Connect(function(input, chat)
    if chat == true then return end -- if chat is true then return to stop func

    if input.Keycode == Enum.Keycode.W then -- if condtion is met then
        if first_step == true then -- if condtion is met then
          -- fire the event
          -- create a remote event, name it whatever you want
          -- and put in ReplicatedStorage
          -- replace "your remote event" with the event name
          game.ReplicatedStorage.your remote event:FireServer()
          first_step = false -- set to false
      else -- else
          first_step = true -- set to true
        end
    end
end)

game.UserInputService.InputEnded:Connect(function(input, chat)
    if chat == true then return end

    if running_ == true then -- if condtion is met then
        if input.Keycode == Enum.Keycode.W then -- if condtion is met then
            -- make a remote event
            -- rename to anything
            -- put in ReplicatedStorage
            -- rename "your second remote" to the event u created
            game.ReplicatedStorage.your second remote:FireServer()
        end
    end
end)
#
-- put this code in a SERVER script, put script in ServerScriptService
-- when a client fires the remote event
-- replace "your remote event" with your remote event
game.ReplicatedStorage.your remote event.OnServerEvent:Connect(function(plr)
    -- set 16 to the amount of speed u want to speed
    -- set the speed to the inputted number
    plr.Character:FindFirstChildOfClass("Humanoid").Walkspeed += 16
end)


-- replace "your second remote" with your other remote event
game.ReplicatedStorage.your second remote.OnServerEvent:Connect(function(plr)
    -- replace 16 with the speed increase you originally put
    plr.Character:FindFirstChildOfClass("Humanoid").Walkspeed -= 16
end)
unborn zenith
#

Thanks! I'll let you know how it goes.

uncut dagger
#

I mean bro wtf do you mean by ```lua
game.ReplicatedStorage.your remote event

hidden pine
uncut dagger
#

yeah just he is brand new, im pretty sure he dosent even know what a remote event is

#

so you gotta make it understanbable to a new scripter

sand island
#

a remote event is a element with a electricy icon and a server icon thing, a remote event allows a local script to tell a server script to do something and vice versa