I've been trying to create a NPC Chat System. My idea is that i want a npc inside a block. And, when you touch the block a Frame pops up with text. How would i do that i've tried this

local Part = script.Parent
local Frame = game.StarterGui.IntelC1
 
	Part.Touched:connect(function(HIT)
	    local H = HIT.Parent:FindFirstChild("Humanoid")
	    if H then
            local Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
           Frame.Parent = game.Player.PlayerGui 
           Player.PlayerGui.IntelC1.CHFrame.Visible = true
    end	end)

But, i got this error "18:30:45.343 - Player is not a valid member of DataModel" Could anyone help? :) Thanks in advance. Got a new error.

5 comments

2

Player.PlayerGui, not game.Players.PlayerGui. The PlayerGui is in the Player object itself, not the Players service.

0

Thank you! :) This should fix it. Add that to the "Answer this question" box too! :D

0

that didn't work. Updated the thread.

0

Kinda like what incapaz said, on line 8 it’s “Player.PlayerGui” not “game.Player.PlayerGui”.

0

That worked Denny! :D Thank you soooooooo much! :D