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

attempt to index string with 'Text' ? I'm trying to find Text property but it errors?

I want to make a stopwatch. I'm not very professional at coding but here is a decent script I produced but before I got to finish, I got this error in the output and I don't understand. It says I'm attempting to index string with the property Text but I'm not. All I'm doing is trying to get the property.

Here is my LocalScript:

local frame = script.Parent
local ifPause = frame.pauseAppear
local PauseButton = frame.Pause
local ResetButton = frame.Reset
local timeText = frame:WaitForChild("Time")

local seconds = 0
local minutes = 0
local hours = 0

timeText = "00:00:00"

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input, gameProcessed)
	if input.KeyCode == Enum.KeyCode.Q then
		for i = 1, math.huge, 1 do
			seconds = i
			if seconds == 60 then
				minutes = minutes + 1
				seconds = 0
			end
			timeText.Text = hours..":"..minutes..":"..seconds --//Errors on this line
			wait(1)
		end
	end
end)

So as I said, I'm not sure what is wrong. Any help would be appreciated and thanks for taking your time.

2 comments

0

You know, a Frame doesn't have a Text property

0

Yes I know

1 answer

✓ Accepted answer

Change line 11 to this:

timeText.Text = "00:00:00"

Sometimes, the recent wrong defining could effect other codes and occurs errors.

1 comment

0

Thanks, I didn't realise i forgot to put that! XD

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