i’m trying to make a hammer animate when the player left clicks, and i want it to show on every screen, is this possible, and if it is, how do i do it?
I wont be replying tonight due to my bedtime, so expect a late response.
You can play an animation on the client or on the server, if you decide to play it on the client, it would be replicated to the server (everyone would be able to see the animation then), but i guess you want to make it inside a localscript since you wanna play the animation when you press left click on a tool.
Step 1:
Make an animation
Step 2:
Upload it to roblox and copy the animations asset id
Step 3:
Create an animation instance inside the ReplicatedStorage, call it how ever you want and paste the asset id into the AnimationId
Step 4:
Put a localscript into the tool you want to animate with this script:
-- / [ Instances ] \ --
local LocalPlayer = game:GetService("Players").LocalPlayer
local Character
if not LocalPlayer.Character then
LocalPlayer.CharacterAdded:Wait()
Character = LocalPlayer.Character
else
Character = LocalPlayer.Character
end
local Animation = game:GetService("ReplicatedStorage").Animation --Path to your animation
local Tool = script.Parent --Path to your tool (tool instance)
local Humanoid = Character:WaitForChild("Humanoid")
-- / [ Functions ] \ --
local SlamAnimation = Humanoid:LoadAnimation(Animation)
-- / [ Values ] \ --
local debounce = true
-- / [ Main script ] \ --
Tool.Activated:Connect(function()
if debounce then
debounce = false
--Do other stuff here
SlamAnimation:Play()
SlamAnimation.Stopped:Wait()
debounce = true
end
end)
I hope this were able to help you!
https://developer.roblox.com/en-us/api-reference/class/Animation
Thanks, it did! (30 Characters)