Hello!
I would like to know how do I give a certain animation to a player who bought a gamepass? The ninja animation. I have the animation inside a localscript.
This is the way I do it. First of all, you need to find the player's character. Inside the character will be a script called 'Animate' and inside that script will be many StringValues AND inside those will be the Animations. To change say the walking animation, you would do this:
--Assuming you already have the Character Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://180426354" -- Replace the numbers with the id of the animation you want to use.
There are other ways to do this but this way doesn't require you to delete the default animation script therefore you don't need to make your own.
Here's how it should look like in the end (server script):
local players = game:GetService("Players") local GamePassId = --Put the id of the gamepass here local WalkAnimationId = --Put the id of the animation here players.PlayerAdded:Connect(function(player) if game:GetService("GamePassService"):PlayerHasPass(player, GamePassId) then print(player.Name .. " has the game pass!") repeat wait() until player.Character player.Character.Animate.walk.WalkAnim.AnimationId = ("rbxassetid://"..WalkAnimationId) else print(player.Name .. " doesn't have the game pass...") end end)
For more information: https://www.robloxdev.com/api-reference/function/GamePassService/PlayerHasPass
Closed as Not Constructive by User#19524
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?