Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Dialog doesnt appear when Clicked on Add Dialog?

Asked by 5 years ago

I wanted to make a gui where people can add dialogs to their own characters however it never shows up :( here is my code:

local ply = game.Players.LocalPlayer.Humanoid.Head
local txt = script.Parent.Parent.TextBox.Text

function onClick()
    local dia = Instance.new("Dialog")
    dia.Parent = ply
    dia.InitialPrompt = txt
end

0
Yes i forgot to add the Mouseclickbutton1:connect thing sorry User#22889 0 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

The Head is not inside of the Humanoid, but inside of the Character.

local ply = game.Players.LocalPlayer
local button -- location of button here
local txt = script.Parent.Parent.TextBox

local function onClick() -- use more local variables unless you need it global
    local dia = Instance.new("Dialog")
    dia.InitialPrompt = txt.Text
    dia.Parent = ply.Character.Head -- it's in character not humanoid
end

button.Activated:Connect(onClick)
0
thank you so much User#22889 0 — 5y
Ad

Answer this question