Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

1 comment

1

That should work.

This discussion is preserved as it was. New answers, comments, and votes are closed.