Is there anyway to get if an animation is made by Roblox?
For example, I want to get all the playing animations on a character and check if any of them are not made by roblox (so exploiters cant play malicious animations)
Here’s my script so far:
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local function CheckAnimations()
local PlayingAnims = Animator:GetPlayingAnimationTracks()
for _, AnimationTrack in pairs(PlayingAnims) do
local AnimId = AnimationTrack.Animation.AnimationId
-- now how do we check if this animation is by roblox?????
end
end
while task.wait(.1) do
CheckAnimations()
end
I just double checked this by loading an animation on the player from the client and I can confirm it does replicate to the server.
try this inside of starterplayerscripts:
task.wait(2)
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://6660663725" -- this is an animation made by me, I tested this under my group game since my group doesnt own the animation
local t = game.Players.LocalPlayer.Character.Humanoid.Animator:LoadAnimation(anim)
while task.wait(.5) do
t:Play()
print("playing from client")
end
local MarketplaceService = game:GetService("MarketplaceService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
local function CheckAnimations()
local PlayingAnims = Animator:GetPlayingAnimationTracks()
for _, AnimationTrack in pairs(PlayingAnims) do
local AnimId = AnimationTrack.Animation.AnimationId
if MarketplaceService:GetProductInfo(AnimId).Creator.Id == 1 then
-- roblox approved
end
end
end
CheckAnimations()
So i don’t really get the point of checking Animations since only animations made by Roblox or the game creator replicate. Also most scripts that do custom animations don’t even load them using the Animator (exploit scripts in this case).
I don’t think this is true unless I’m testing it wrong, but I was able to load an animation owned by my account on a group game.
Yes, I do understand this. I decided to make this topic more general since my use case is pretty specific. I’m basically storing all of the players animations that play at what times, and I needed a way to make sure all of the animations being played are okay so exploited animations don’t get saved.
I’ve just tested this and even though the animation doesn’t playback, the server still finds when using Animator:GetPlayingAnimationTracks()
local script:
task.wait(2)
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://5662408537" -- this is the animation you provided
local t = game.Players.LocalPlayer.Character.Humanoid.Animator:LoadAnimation(anim)
while task.wait(.5) do
t:Play()
print("playing from client")
end
part of server script:
local PlayingAnims = Animator:GetPlayingAnimationTracks()
for _, AnimationTrack in pairs(PlayingAnims) do
local AnimId = string.match(AnimationTrack.Animation.AnimationId, "%d+") -- gets only the id from animationid
-- checks creator id through marketplace service and prints if the id is not found inside a table of whitelisted ids
This is interesting because I’ve always thought animations could playback when loaded from the client even if not made by the owner, but still the server still finds the animation under GetPlayingAnimationTracks so checking this is still necessary. Thanks!