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

Troubling animations always screw me.. ( Any help? )

Asked by 6 years ago
Edited 6 years ago

I'm trying to make a tool that when you click it, It plays an animation and it gives a menu to the player that the person clicked. I've already created a script for giving the "GiveMenu" tool to the player. I get an error about the Animation failing to load when I get the tool in my Inventory, and when I click a player. Any help?

Note: I put all of this into a Local Script and the tool is located in Server Storage.

Errors:

"Animation "http://www.roblox.com//asset/?id=44911345&serverplaceid=1372052778" failed to load in "Animation.AnimationId": Animation failed to load"

"Players.LennonLight.Backpack.GiveMenu.Animation:11: attempt to index local 'whatWasClicked' (a nil value) (Line 11)"

local animation = Instance.new("Animation")
wait(1)
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local player = plr.Character

animation.AnimationId = "rbxassetid://44911345"
animTrack = player.Humanoid:LoadAnimation(animation)

Mouse.Button1Down:connect(function(whatWasClicked)
    if whatWasClicked.Parent.Name == "Torso" then
        animTrack:Play()
        wait(0.75)
        player:FindFirstChild("Backpack").GiveMenu:Destroy()
        game.ServerStorage.GiveMenu:Clone().Parent = whatWasClicked:FindFirstChild("Backpack")
        if whatWasClicked.Backpack == nil then
            game.ServerStorage.GiveMenu:Clone().Parent = whatWasClicked.Character:FindFirstChild("Backpack")
        end
    end
end)

2 answers

Log in to vote
0
Answered by 6 years ago

I get the error "Players.glossydon.Backpack.Tool.LocalScript:11: attempt to index local 'whatWasClicked' (a nil value)," and I believe I know why: you aren't referencing anything! Try using the mouse's Target to get the exact part which the mouse is over. Better yet, you can Filter what checks out using an array.

Ad
Log in to vote
0
Answered by 6 years ago

You may want to use the animation from alvin blox. Go to his yt channel and look up animation. And then watch his video. It should solve any problem with animation.

Answer this question