Hi guys,
I have parts through out my game that I use to control other elements of the map. I want to access the PlayerGUI
of the Player that touched one of these parts, however, I cannot seem to figure it out, and honestly I am not sure if it is possible to begin with.
This is the script that I am currently testing with:
Summary
local part = script.Parent
function onTouched(h)
local h = h.Parent:FindFirstChild("Humanoid")
local character = h.Parent.Name
print(character)
local player = game.Players.character
local dialogueUI = player.PlayerGUI.DialogueUI
if h ~= nil then
workspace.Ignored.Barriers.Barrier1:Destroy()
part:Destroy()
end
end
script.Parent.Touched:Connect(onTouched)
When using this script, I get this error:
If anyone can get me moving in the right direction, that’ll be great!