local dialogue = script.Parent.Parent.DialogueBox
local d = script.Parent
d.MouseButton1Down:connect(function(User)
    local function say(string, text, w) -- Here's a function you could use, where 'string' is what you want to display, 'text' is the TextObject you want it to display in, and 'w' is the time you want it to wait between each letter.
        local waitTime = w or .02
        for i = 1, string.len(string) do
            text.Text = string.sub(string, 1, i)
            wait(waitTime)
        end
    end

   local player = User
    local dialogue = User.PlayerGui.ScreenGui1.DialogueBox
    local close = User.PlayerGui.ScreenGui1.CloseButton
    local name = User.PlayerGui.ScreenGui1.NameBox
    local option1 = User.PlayerGui.ScreenGui1.Option1
    local option2 = User.PlayerGui.ScreenGui1.Option2
local option3 = User.PlayerGui.ScreenGui1.Option3
    local option4 = User.PlayerGui.ScreenGui1.Option4
    name.Visible = true
    option1.Visible = false
    option2.Visible = false
	option3.Visible = true
    option4.Visible = true
    close.Visible = true
    dialogue.Visible = true
    name.Text = "Cassie"
    option3.Text = ""
    option4.Text = ""
    say('Alright. Welcome to our town, Jeris. Generations of people have lived here, and though it has taken a long period of time, we have managed to build a lot. We are successful, but recently a problem arose. Bandits and monsters are invading, and it seems nothing is safe anymore. Young traveler, can you help us?', dialogue, .02)

end)

That's the script. When I activate it by clicking option1 gui button, the output says: 19:57:37.879 - Auto-Saving... 19:57:38.655 - FormFactor is deprecated. You should no longer use this property. Loading Cutscene Editor... Cutscene Editor Loaded 19:57:46.476 - Players.Player1.PlayerGui.ScreenGui1.Option1.Script:13: attempt to index local 'User' (a number value) 19:57:46.477 - Stack Begin 19:57:46.477 - Script 'Players.Player1.PlayerGui.ScreenGui1.Option1.Script', Line 13 19:57:46.478 - Stack End

I don't really understand what is wrong with the script. Please help!

2 comments

0

MouseButton1Down returns the mouse position, not the player. You should be using a LocalScript for this, meaning you can get the player by using LocalPlayer.

0

Hmm...Okay.