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

I am trying to make it so when i click a certain part. How do i do it?

Asked by 5 years ago
Edited 5 years ago

when you click the part it's meant to affect the gui / slot

an error shows up when i start a local server but not when in normal studio

script.Parent.MouseClick:Connect(function(plr) 

      slotNumber = slotNumber + 1
       slotName = "slot" .. slotNumber

 slot = plr.Parent.PlayerGui.Inventory.bg:FindFirstChild(slotName)
slott = plr.Parent.PlayerGui.Inventory.bg:FindFirstChild(script.Parent.Parent.itemName.Value) 
sslott()

end)

the error message is : 19:27:44.602 - PlayerGui is not a valid member of Players

Thanks

1 answer

Log in to vote
0
Answered by
waifuSZN 123
5 years ago

A PlayerGui is an object of the specific player; you are defining PlayerGui as Players (plr.Parent); try doing plr.PlayerGui instead.

1
That should work. chexburger 358 — 5y
Ad

Answer this question