Hey there,
I’m currently making a homemade dialog system where if you press F after clicking a text option, the dialog will continue (if you keep pressing F more dialog will be revealed).
This works perfectly fine if I try to, for example, fire an event or print something. But if I want to change the dialog text it simply refuses to work - no errors are given either.
I’ve tried changing the variable from “frame.Dialog.text” to “script.Parent.Dialog.Text”, looked for solutions online ect. to no avail.
Help would be greatly appreciated! You can find a snippet of the code I’m on about below:
-- note to self: incase dialog should be longer, simply add multiple onKeyPress functions.
local frame = script.Parent
local userId = game.Players.LocalPlayer.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = game.Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
local player = game.Players.LocalPlayer
local path1activated = false
local path2activated = false
local path3activated = false
frame.Option1.MouseButton1Down:Connect(function()
frame.Option1.BackgroundColor3 = Color3.fromRGB(99, 186, 49)
frame.ThumbnailPlayer.Image = content
frame.ThumbnailPlayer.Visible = true
frame.ThumbnailSpeaker.Visible = false
frame.Dialog.Text = "Good day! May I have a look at your stock?"
frame.NameTxt.Text = game.Players.LocalPlayer.Name
if path1activated == false then
path1activated = true
path2activated = false
path3activated = false
frame.Continue.Visible = true
local function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.F
and path1activated == true then
frame.ThumbnailPlayer.Visible = false
frame.ThumbnailSpeaker.Visible = true
frame.NameTxt.Text = frame.SpeakerName.Value
frame.Dialog.Text = "Ofcourse ye may - have a gander..."
-----
local function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.F
and path1activated == true then
frame.Dialog.Text = "template text"
print("this works")
--- add store gui script
end
end
game:GetService("UserInputService").InputBegan:Connect(onKeyPress)
end
end
game:GetService("UserInputService").InputBegan:Connect(onKeyPress)
end
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.