Why doesn't this Roblox studio script work?

Hello, I'm learning programming and am currently working on a tycoon.

I wanted to program it so that there's money, and every second the amount is increased by one. And when you click on the cash register, the money should be added to the text label. I wrote this script:

But when I try it, nothing is added to the money. Can anyone help me?

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
4 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Devrunrik
7 months ago

This is a very common beginner mistake. I did it at the beginning.

You just have to do this:

local textlabel = game.players.localplayer.Playergui:WaitForChild(„TextLabel“)

So you need to use playergui instead of Startergui.

Suiram1
7 months ago

You use a while True loop there that blocks the execution. This means the event handler for the click will never be added. You must add the event handler before the while loop.

Long-termick would make sense to solve this differently. Vllt. there is a timer that can trigger a callback.