Why does this work in studio but not in online mode?
I have made a pokemon-like gui where is individually types out the letters and plays a sound. Here are all the things I have in it:
Local Script - Named Local Script
local gui = script.Parent
local tick = script.Parent.Tick
local text = script.Parent.TextLabel
if game.Players.LocalPlayer.Name ~= "Player" then
end
if text.Visible == true then
function mes(text1, text2, wait1)
for i=1,string.len(text2) do
if string.sub(text2,i,i)==" " then
text1.Text=string.sub(text2,1,i)
i=i+1
wait(wait1)
else
text1.Text=string.sub(text2,1,i)
i=i+1
tick:Play()
wait(wait1)
end
end
end
text.Text = ""
mes(text, "Welcome to Bakery Tycoon! I hope that you have a wonderful time making some nice pastry products. Maybe you'll even become Santa's little elf or a mini Santa. Who knows? Go explore and find out!", 0.08)
end
Audio - Named Tick SoundID: rbxassetid://140910211 RollOffMode: Inverse PlaybackSpeed: 3.5 EmitterSize: 10 -- Should be essential properties there ^
Text Label - Named TextLabel
This is all inside a ScreenGui and works in studio but not in online mode.
It says Tick is not a valid member of ScreenGui
Line 3
Here is the place if you want to see the error code yourself

3 comments
I'm pretty sure 'Tick' has just not loaded yet. Try using WaitForChild.
Ok thanks
And if you wanna clean up the 'mes' function.. https://scriptinghelpers.org/questions/19962