Still have questions? Join our Discord server and get real time help.
Log in to vote

How to make an object from backpack orbit something in workspace?

Asked by 6 days ago

Okay, so basically, here's my problem: (I'm pretty new to coding.)

I'm trying to make it so when a player pulls out a gun (in this case its an item from a backpack) something else from the backpack orbits around it.

There is a shotty in the game called The Streets and I want soda cans to orbit it whenever you pull the gun out.

I've got the basics laid out (possibly...)

local player = game.Players.LocalPlayer
if game.Players.LocalPlayer.Backpack.Shotty == nil then
    if game.Workspace.player.Shotty == true
    then if game.Players.LocalPlayer.Backpack.Drink == true

I don't know how to finish it, and I'm almost positive I messed up the beginning.

Thanks in advance.

what type of objects are Shotty and Drink? theking48989987 1853 — 6d

1 answer

Log in to vote
Answered by 6 days ago

you think it the wrong way. you think something fly out of backpack. no.

when you equip a gun, a onequip event will be triggered. write the code insider.

the code will be, create an object out of thin air, "" and set parent to, and position will be close to the gun...

then, when the gun is equipped(in the same event), you want to know the position of nozzle point of the gun,

third, you learn how to circle an object around the nozzle point. or just use constraints.

then, in the unequip event,

you remove that object circling


Answer this question