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

My script won't work and nothing is showing in the output! I tried everything I know. Help?

I am trying this script out but it won't work. I looked at the output and not showing there. But the goal of the script is not working.... Here is the script:

script.Parent.MouseClick:Connect(function()
	game.StarterGui.NpcChat.Background.Visible = true
end)

Key: NpcChat = ScreenGui Background = Frame Parent = a dummy r6 model

(The goal of this script is that when you click the Npc's torso, a frame appears)

Currently the Background is not visible and I'm really confused... Is there anything I need to change in the StarterGuy? Or is their a error? Please help!

1 comment

0

I don't get what you're asking... when you click the NPC's torso a frame appears?, also if you're posting scripts please use codeblocks.

2 answers

I think what you could do is put a click detector in the torso and do a .MouseClicked event, then just set the frame Visiblity = true if it has been clicked.

1 comment

0

MouseClick is already being called from script.Parent, which shows the existing presence of a ClickDetector already.

StarterGui is not the authentic storage location of the local UI. Each Player has their own GUI container called PlayerGui. Upon joining, all the contents of StarterGui are actively moved into said container to effectively give the Player their own UI. This is done because if all GUI Objects get stored and read from one place, such a StarterGui, everyone would see the same GUI appear, and would loose the personal use of their own screen.

You need to call upon the Players PlayerGui` container to actively manage their UI properly.

local ClickDetector = script.Parent

ClickDetector.MouseClick:Connect(function(PlayerClicked)
    PlayerClicked.PlayerGui.NpcChat.Background.Visible = true
end

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