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

PlayerGui is not a valid member of DataModel?

script.Parent.ClickPart.ClickDetector.MouseClick:Connect(function()
	script.Parent.Parent = game.ServerStorage.PlayerINV
	if game.ServerStorage.PlayerINV:WaitForChild("SparkPlug") then
		game.PlayerGui.Pickup.BG.Visible = true
	end
end)

1 comment

0

What did i DO wrong?

1 answer

Hello.


PlayerGui is not a service, but a child of a player. In this case, you can get the player from the parameter of MouseClick, and then just indexing PlayerGui.


Here's your fixed script:

script.Parent.ClickPart.ClickDetector.MouseClick:Connect(function(player)
    script.Parent.Parent = game.ServerStorage.PlayerINV
    if game.ServerStorage.PlayerINV:WaitForChild("SparkPlug") then
        player.PlayerGui.Pickup.BG.Visible = true
    end
end)

I hope this helps. Cheers!

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