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

How to make tool appear in different part of an animation?

Asked by 5 years ago

I made an animation of equip, shoot, and unequip for a game, this is the script:

local tool = script.Parent
local handle = tool.Handle
local player = game.Players.LocalPlayer
local char = player.Character

script.Parent.Equipped:connect(function(eventMouse)
    eventMouse.Icon = "http://www.roblox.com/asset/?id=316279304"
    local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Equip)
    animation:Play()
end)

script.Parent.Activated:connect(function()
    local animation2 = player.Character.Humanoid:LoadAnimation(script.Parent.Start)
    animation2:Play()
    local mouse = player:GetMouse()
    local bulletClone = game.ReplicatedStorage.Bullet:Clone()
    bulletClone.Parent = game.Workspace
    bulletClone.Position = Vector3.new(mouse.Hit.Position)
end)

tool.Unequipped:connect(function()
    local anim = player.Character.Humanoid:LoadAnimation(script.Parent.Unequip)
    anim:Play()
end)

but the tool doesnt appear at the time of that animation, this is problem https://gyazo.com/d7eabff9d44357b5b42a25fbc7babe97 i want it to appear when u taken it out, same for unequip, tool disappears quickly than animation

1 answer

Log in to vote
0
Answered by
Echtic 128
5 years ago

A lot of people would probably do this in some other way, but here's my suggestion. Try defining all of the parts that make your tool, and set their transparency to 1, after that make the transparency of all parts 0 again inside the script in the line under your equip animation:Play(). Make sure to put a wait() in between those, make it wait for the duration of the equipping animation.

For the unequipping one, try cloning all the tool parts, and welding them to the hand(without them having anything inside them) set their transparency to 1. Make the transparency 0 under the Unequipped() function. Add a wait() after with the duration of the animation inside it, and make the transparency 1 again.

Ad

Answer this question