I am making a server sided script that clones a tool to the players backpack and I am getting the error "ShopGui is not a valid member of PlayerGui". For some reason, I cant get to the PlayerGui. Here's my script:
Events.Equip.OnServerEvent:Connect(function(player)
local Character = player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local new = game.ReplicatedStorage.Items:FindFirstChild(player.PlayerGui.ShopGui.MainFrame.Selected.Value):Clone()
new.Parent = player.Backpack
print("Cloned")
player.Items:FindFirstChild(player.PlayerGui.ShopGui.MainFrame.Selected.Value).Value = true
Humanoid:EquipTool(game:GetService("ReplicatedStorage").Items:FindFirstChild(player.PlayerGui.ShopGui.MainFrame.Selected.Value))
print("Equipped")
end)
Any ideas?
