Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I transfer a clonedPart into another remote event?

Asked by 6 years ago

Okay, I apologize if this is too much to digest, but I really need some help for this problem. (at times I believe there is no solution to this problem.);

01game.ReplicatedStorage.clipEvent.OnServerEvent:Connect(function(player,gun)
02    local checkV = gun.Debounces.alreadyOpen
03    if x then
04        x = false
05                local cloneClip = game.ReplicatedStorage.Clip:Clone()
06                cloneClip.Name = "9mm Ammo"
07                cloneClip.Parent = workspace
08                cloneClip.CFrame = player.Character.LeftHand.CFrame
09                cloneClip.Anchored = false
10                local guiclone = game.ReplicatedStorage.GUI:Clone()
11                guiclone.Parent = cloneClip
12                local magnitude = (player.Character.HumanoidRootPart.Position - cloneClip.Position).Magnitude
13                coroutine.wrap(function()
14                    while wait() do
15                        magnitude = (player.Character.HumanoidRootPart.Position - cloneClip.Position).Magnitude
View all 33 lines...

^^ This is the event, It's supposed to clone a clip copy, and move it to the players left hand. (this works fine), now the GUI clone is cloning a billboardGUI, that says "Press F to pick up ammo". It is supposed to show whenever the magnitude between the player and the clonedclip is smaller than or equal to 10. (this also works fine.),

The checkV debounce is to stop 2 GUI's showing up if there is 2 ammo on the floor. (so that the player picks up 1 piece of ammo), the value changes back to 0 when the clonedclip on the floor is deleted, and the ammo is added to the gun.

^ This works, but now I don't know how to transfer the clonedClip into another remote event. since it produces a lot of clonedclips with the same name.

Please, any suggestions leave them. Anything helps!

0
Pass the cloneClip as a parameter, or use a RemoteFunction to return that clonedClip. User#19524 175 — 6y

Answer this question