Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is my Group Hint Gui script erroring?

For some reason, it isn't working, I've tried doing some changes, but it just comes up with the same error, the error says 15:08:57.372 - Players.Player1.PlayerGui.ScreenGui.LocalScript:7: bad argument #1 to 'sub' (string expected, got table) 15:08:57.373 - Script 'Players.Player1.PlayerGui.ScreenGui.LocalScript', Line 7 15:08:57.374 - Stack End, but I don't get what I'm doing wrong, here is the script;

repeat wait(0)until game.Players.LocalPlayer and script.Parent and script.Parent.Parent and script.Parent:FindFirstChild("GroupText",true)

local Texts = {"Hello, and welcome to TheeDeathCaster's HOLO Facility!","If there are no Trainers around, then please wait or request a High Rank.","If you are a High Rank and you want to host a Training, then please notify TheeDeathCaster before doing so.","Be user friends to your comrades, or else that will result in you getting kicked and banned from the group.","If you have any questions please let TheeDeathCaster know."}

while game.Players.LocalPlayer:IsA("Player") do
for z = 1, #Texts do
script.Parent.GroupText.Text = tostring(string.sub(Texts,1,z))
wait(.7)
end
wait(3)
end

1 answer

✓ Accepted answer

Since Texts is a list, you don't have to use tostring or string.sub. All you need is:

while game.Players.LocalPlayer:IsA("Player") do
for z = 1, #Texts do
script.Parent.GroupText.Text = texts[z])
wait(.7)
end
wait(3)
end

4 comments

2

line 3, it should be 'texts[z]'. Just so you know.

0

Sorry, good catch. I'm used to using i for all my for loops :P

1

ipiano: You should edit your answer to include that fix

0

Well, I just found the problem out. But don't worry, this can come in handy when I'm scripting something (I didn't really know this type of scripting)! :) Thanks man! :)

This discussion is preserved as it was. New answers, comments, and votes are closed.