The players backpack is just player.Backpack. And also the character thing is useless, because you do not need it. Also make sure that you are giving the gun on the server, not the client! I thought it was a click detector but after I saw the comments lol, but I fixed the code. If it is in a local script, you should use a event to connect the client to the server, and to get the player.
local event = game.ReplicatedStorage:WaitForChild('RemoteEvent')
script.Parent.MouseButton1Click:Connect(function()
event:FireServer()
end
In a server script it should be
local event = game.ReplicatedStorage:WaitForChild('RemoteEvent')
local function giveTool(player)
local gun = game.ReplicatedStorage.Minigun:Clone()
gun.Parent = player.Backpack
end
event.OnServerEvent:Connect(giveTool)
Please accept my answer if your issue is solved, and let me know if you need any more help!
5 comments
i doesnt work
Use "gun.Parent = game.Players.LocalPlayer.Backpack".
You can't get the player from the MouseButton1Click event.
none of these work im using a local script in starter gui
fixed the issues srry i thought it was a click detector lol