Item is disappearing when being clicked on (drag and drop system)

Ok, I’m a bit lost here, I only have a couple of months of scripting experience. Was I supposed to use a local script instead?

Well you could use either one, though I recommend using a local script, as for it will move the item locally for the player.

1 Like

the thing is, when I use a local script, nothing happens.

Yes, I know. That’s because local script only work in certain places in the Hierarchy, such as ReplicatedFirst, StarterGui, etc. So, for that, I would recommend creating server script and creating a remote event that fires the client once the item is clicked then, on the Client event you could actually move the part in a local script, in StarterGui, per say.

If you don’t know about RemoteEvents or how to use them the developer hub has a great article on Remote Events here.

1 Like

oh ok, I’ll look into that. Thanks.

1 Like

Sorry for bothering you again :grimacing: But is this bug happening because I just used a server script and didn’t use RemoteEvents? I want to understand what caused the problem.

Sorry for the really late response, but to be quite honest with you I don’t know what is causing the problem. At first, I thought it was because you didn’t put CFrame.new() but then it didn’t work. Make sure the item is anchored. And, I would also suggest to maybe use print() functions to debug your code, like printing the camera’s CFrame and the Item’s CFrame. And the reason I suggested using remote events was in order to make picking up the box local for the player. Aside from that, I do not know how to help you :confused:

1 Like

I think the problem is that where you put

local itemPosition = camCFrame + camCFrame.lookVector * 6

the game doesn’t know if its x, y or z.