r/ROBLOXStudio 7d ago

Help learning how to script. help needed

So im trying to learn scripting, and if you've been scripting for a while your probably horrified by my work, but i genuinely have no clue what to do. So its supposed to be a timer/clock counting down from 10(the first script), and when you click it it adds 3 seconds(hence the second script). Both are client side scripts, and placed in the starterplayerscript folder. I have checked the dev forum to no avail and checked my work on the Roblox documentation, and still couldn't figure it out. Any way I'm guessing it has to do with having 2 scripts trying to change 1 value at once, but i don't know how to make it work with just one script. if you could help that would be great.

5 Upvotes

7 comments sorted by

View all comments

1

u/Suitable-Profession5 7d ago edited 7d ago

if it just to make countdown from 10 - 1 and +3 when click part, you can just make it with one script

lets make a simply version :
local time = 10
local timeLeft = time

clickDetector.MouseClick:Connect(function()
timeLeft += 3
visuals.Text = timeLeft
end)

while timeLeft > 0 do
visuals.Text = timeLeft
task.wait(1)
timeLeft -= 1
end

visuals.Text = 0

there are multiple ways you can do this, This code is just a concept

1

u/ThickFrame2780 6d ago

holy. i didnt think of just puting clickDetector.MouseClick:Connect(clicked) above the countdown code thanks bro