This is in a LocalScript in an ImageButton in a ScreenGui in StarterGui.
player = game.Players.LocalPlayer
timer = script.Parent.Timer
enabled = true
function onClick(click)
if player.ItemCounter["Quick Mushroom"].Value > 0 and enabled == true then
enabled = false
player.ItemCounter["Quick Mushroom"].Value = player.ItemCounter["Quick Mushroom"].Value - 1
player.Character.Humanoid.WalkSpeed = 48
timer.Visible = true
timer.Text = "2:00"
minutes = 2
for seconds = 120, 0, -1 do
local seconds2 = seconds - 60
local secondsdisplay = seconds2
if seconds == 119 then
minutes = 1
end
if seconds == 59 then
minutes = 0
end
if seconds2 < 10 then
secondsdisplay = "0"..seconds2
end
if seconds < 60 then
secondsdisplay = seconds
end
if seconds < 10 then
secondsdisplay = "0"..seconds
end
if secondsdisplay == 60 then
secondsdisplay = "00"
end
timer.Text = minutes..":"..secondsdisplay
wait(1)
end
player.Character.Humanoid.WalkSpeed = 24
timer.Visible = false
enabled = true
end
end
script.Parent.MouseButton1Click:connect(onClick)
The script runs just fine in studio, but when playing in-game, an error appears on Line 2 stating that "Timer" is not a valid member of ImageButton. However, when going into Studio, there is indeed a TextLabel in the ImageButton named "Timer". What's going on here?

2 comments
len means length. It returns the length of a string. Wow I'm late.
Haha yeah you are, but I appreciate the answer because I still didn't know what len was until now.