I want to make a gun slider, however, I’m conflicted, as if the player moves, the tween will error or something – imagine if a part was welded to the gun and it moved slightly backwards. I’m not exactly sure how to explain this but I need help creating this.
If you are tweening the weld between the gun and the slide then the slide should stay relative to wherever the Position of the gun is no matter how much it moves.
Have you tried it to see what happens?
Yea
It didn’t quite work though… It instead moved to the position yes, but it didn’t move to my desired position
What’s your script?
Are you tweening the slide only one way, or both ways?
Does it change if you are standing still?
I use a preset part (a part moved a bit behind that’s invisible)
local s = script.Parent
wait(5)
local tn = TweenInfo.new(3)
local ts = game:GetService("TweenService")
ts:Create(s.slide, tn, {Position=s.slidetest.Position}):Play()
I tween it one way for testing, and it will move if you stand still, but if you move, it’ll make the positioning weird.
I think it’s because you are performing the tween over 3 seconds and returning s.slide to the s.slidetest.Position that it was at the beginning of the tweens (3 seconds previous to it’s current Position).
I had a look at TweenInfo | Roblox Creator Documentation and it tells me you’ve set the time of the tween to 3 seconds, but you haven’t set any of the other parameters.
I’m not sure how you’d get the tween to update to a moving Part. Perhaps an Animation would be better?
Don’t use TweenService, it’s not fit for this purpose. Use an Animation instead, if you want the length of the tween to be 3 seconds; it won’t work as if the player moves it will break it regardless.
All guns typically use an animation, Roblox has an animation builder that will make this much simpler, see an Animation tutorial if you’re stuck.
Thanks, I’ll try that out! I’m thinking of making a possum gun as well, just not too sure how to do that though. How would I weld a possum accessory onto a gun? I’d name my gun ‘Possuminator’.
Looking forward to a response!
