#How do I make this text work when a tool is activated?

1 messages · Page 1 of 1 (latest)

stray raptor
#

Hi! I want to make a script that will cause the typewriter text to happen when a tool is activated. Currently, the textSound activates but the actual text doesn't change. Here is the script I tried

local text = StarterGui.Apple.Frame.TextLabel
local talkSound = script.talkSound

local function onActivated()
local function writeText (message,WaitTime)
    text.Text = " "
    text.Visible = true
    for i = 1, #message, 1 do
        talkSound:Play()
        text.Text = string.sub(message,1,i)
        task.wait(WaitTime)
    end
    
end
writeText("So, you really wanna know?", 0.08)
end
script.Parent.Activated:connect(onActivated);```
I'm new to scripting, so it may be a random tiny mistake.
#

How do I make this text work when a tool is activated?

tardy pecan
#

its not working cuz

#
local StarterGui = game:GetService("StarterGui")
local text = StarterGui.Apple.Frame.TextLabel```
#

this

#

you are not refering to gui

tame driftBOT
#

studio** You are now Level 7! **studio

tardy pecan
#

that is replicated for player

#

you are refering to gui in startergui

#

you need to add sth like

#

local text = player.PlayerGui.Apple.Frame.TextLabel