the chest script

script.Parent.MouseClick:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	local plr = game.Players.LocalPlayer

 for d,tools in pairs(plr.Backpack:GetChildren()) do 
	
	local i = Instance.new("TextLabel")
	local find = plr.PlayerGui:FindFirstChild("pack")
	i.Parent = find.Back
	if tools:IsA("Tool") then	
		i.Text = tools.Name
		find.Back.Visible = false
		print(tools.Name)
	end
	end
end)

the GUI script/Localscript


	local plr = game.Players.LocalPlayer
	
 for d,tools in pairs(plr.Backpack:GetChildren()) do 
	local i = Instance.new("TextButton")
	i.BackgroundTransparency = .5
	

	local find = plr.PlayerGui:FindFirstChild("pack")
	i.Parent = find.Back
	if tools:IsA("Tool") then
		--local clone = tools:Clone()
		--clone.Parent = script.Parent.wopens
		tools.Parent = script.Parent.wopens
		i.Text = tools.Name
		print(tools.Name)
		
		i.MouseButton1Click:Connect(function()
			local cop = script.Parent.wopens:FindFirstChild(i.Text)
			 cop:Destroy()
			i:Destroy()
		end)
		end 
		
	end

5 comments

0

server scripts cannot get the localplayer

0

could you explain more pls

0

I mean, if you tell a teacher to get the local student, the teacher is going to be extremely confused

0

^

0

local player = game.Players:GetPlayerFromCharacter(hit.Parent)