So I am creating a game where you have to capture tesla coils in order to win, and I have a loadout screen for this game so you can get a weapon before you enter.

Now, how the loadout screen works is when you load in, you have a loadout gui which gives you names of guns and you can click on these guns using a TextButton and this clones the gun to the player's backpack, but it's not working.

What I've tried to do is to use a RemoteEvent but that doesn't work and I am under the belief that a RemoteFunction does not work either because of something to do with communication not working from the server to the client so I am in trouble.

Here is my original localscript for the TextButton that would give you the gun:

local click = game.Players.LocalPlayer.PlayerGui:WaitForChild("LoadoutGui").TextButton
local player = game.Players.LocalPlayer
local loadout = game.Players.LocalPlayer.PlayerGui:WaitForChild("LoadoutGui")

click.MouseButton1Click:Connect(function()
	local gun = game.ReplicatedStorage["M4A1"]
	gun:Clone().Parent = player:WaitForChild("Backpack")
	loadout.Enabled = false
end)

This did end up cloning the gun, but the gun was not functioning whatsoever and it disappeared upon reset.

To elaborate more on "not functioning": when I selected the gun, nothing appeared in the avatars hand despite it showing that the gun was indeed selected by having the blue square around the tool square icon.

I really need help with this because this is the final piece to my game which I've spent some time on.

Any help is appreciated.

1 comment

0

Sounds like a problem with the gun.