Need help with scripting a arrow animation with spritesheets

So im working on a rhythm game and it’s gonna have ui animations, the thing is, I don’t know how to do those, all I can find is how to play a gif on a part, not a ui element, and I don’t have enough scripting knowledge to edit that script to make it work with ui elements.

1 Like

i dont really understand the question but to move guis, u can use gui:TweenPosition

1 Like

That isn’t really what im looking for, im talking about spritesheet animations, not tweens. And I already know how to use tweens.

1 Like

You first make a spritesheet then get the dimensions of each sprite, then use the ImageRectOffest and ImageRectSize:

This topic may help you.

2 Likes

I saw your post while looking for information on how to use spritesheet animations, All I need is the script, I already have the values I need.

1 Like

I’ll look at the sprite clip module and see if that can help me.

1 Like

Well #help-and-feedback:scripting-support isn’t really for people making scripts for you, you’re going to have to try yourself.

This may help you.

Here’s some explanation on how it works.

3 Likes

Do note that any low-resolution image will end up blurry due to obligatory linear upscaling Roblox performs (this includes 9-slicing, which is what my module does). Unless you have like 8-10 frames for a relatively small sprite, your image will end up really ugly.

2 Likes

I only have 3 frames for the spritesheet i wanna use.

Also, the anim didnt work and I made sure I did everything correctly, and I did.

Nvm, I forgot to define the offset and that stuff.

So, I got everything to work, but when the animation plays for the first time, the next time it plays the animation it only plays the last 2 frames instead of restarting the entire animation.

You’ll have to post the code that sets it up, together with the actual sprite and image dimensions. Can’t do much without any info.

The image is 683 x 228

local la,ra,ua,da = script.Parent.plr1.arrows.left, script.Parent.plr1.arrows.right, script.Parent.plr1.arrows.up, script.Parent.plr1.arrows.down
local lh,rh,uh,dh = la.lefthit, ra.righthit, ua.uphit, da.downhit
local SpriteClip = require(script.SpriteClip)
local downhit = SpriteClip.new()
downhit.Adornee = dh
downhit.SpriteCountX = 3
downhit.SpriteCount = 3
downhit.FrameRate = 1 --framerate is 1 for testing purposes
downhit.Looped = true
downhit.SpriteSizePixel = Vector2.new(231, 228)
downhit:Play()

downhit_anim

I found an error that somehow got unnoticed for over a year and fixed it. An updated version will be linked in the original topic. Just replacing the old module with the new one should do the trick. Please tell if the issue still persists.

1 Like

Yup! It works now! Thanks! :grinning_face_with_smiling_eyes:

1 Like

also I found a little typo in your post:
image
it should be bool not number

1 Like

Also, I forgot to remove a print in the module. Doesn’t really affect the end result, but it’s a bit spammy. Updated the module, but it’s easy to remove without downloading again.

1 Like

I think its a bug because I did it wrong but the animation doesnt work.

I can’t find anything that could be causing this issue. Might even be a bug on Roblox’s end.
Can you show the RectImageSize and RectImageOffset values at the bottom of the label’s properties when turning it on and off?

1 Like