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

How to use animations for things in replicatedstorage?

Asked by
Lyphios 77
4 years ago

I've asked this before, and nobody responded. I also can't find the question any more. In my game, I have a viewmodel inside of replicated storage and in the viewmodel there is a reload animation. Inside of startercharacterscripts, I've got a local script with the following code:

Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
local Reload = game.ReplicatedStorage.M1911.Reload
mouse.KeyDown:connect(function(key)
key = key:lower()
    if key == "r" then
        Reload = Player.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.M1911.Reload)
        Reload:Play()
    elseif key == "r" then
        if Reload ~= nil then
            Reload:Stop()
        end
    end
end)

I want it so that when "r" is pressed, the animation plays, but it doesn't work. Please help me!

Answer this question