Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my Group Hint Gui script erroring?

Asked by 10 years ago

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

Log in to vote
0
Answered by
ipiano 120
10 years ago

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
2
line 3, it should be 'texts[z]'. Just so you know. GoldenPhysics 474 — 10y
0
Sorry, good catch. I'm used to using i for all my for loops :P ipiano 120 — 10y
1
ipiano: You should edit your answer to include that fix BlueTaslem 18071 — 10y
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! :) TheeDeathCaster 2368 — 10y
Ad

Answer this question