Help needed with script

There is no error in output. (30char)

Where is this script and is there an remote event or remote function?

1 Like

This does not work. (30characters)

It is a server script, and it is in the part you touch to get the gear.

So it’s a Touched Event? if im Correct, if im Not Sorry,

1 Like

that is correct, It is a touched event.

Okay Then Try this: https://www.youtube.com/watch?v=GjnLH_4lI-w

1 Like

And Tell me if you get it Right, if Not Then Uh Sorry

1 Like

This does not work, thanks for your time.

Send me all of the code that you have in the script.

1 Like

local debounce = false
local Gear = game.ReplicatedStorage.Gears:FindFirstChild(“Gear”)

script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) and debounce == false then
while true do
s = 0
m = 5
local player = game.Players:FindFirstChild(hit.Parent.Name)
Gear:Clone().Parent = player.Backpack
repeat
debounce = true
script.Parent.Text.Timer.Seconds.Value = s
script.Parent.Text.Timer.Minutes.Value = m
wait(1)
s = s-1
if s == -1 then
m = m-1
s = 59
if m == -1 then
m = 0
s = 0
end
end
until s == 0 and m == 0
debounce = false
return debounce
end
end
end)

Could it be that your script is timing out because you dont have a wait under your wtd loop?

1 Like

It could be that there is no wait under it… you put it above, move it below.

1 Like

This code should be working fine, I just copied it into my studio and had the counter running.
Few things,

  • Check this line, quotes are weird

if hit.Parent:FindFirstChild(“Humanoid”) and debounce == false then

  • Make s and m local values.
  • Why the while true do loop? After 5 minutes, this will just count down from 5 minutes again.
1 Like

Not its only because you copied it from foriums so the conversion is weird

1 Like

This does not help, thanks anyways.

The solution is instead of putting until “s == 0 and m == 0” put “until s == -1 and m == 0”

1 Like

This does not help. (30character)

This does not work, thanks anyways!

Sorry this didn’t help. I meant that this code wasn’t the problem and that the problem might be the timer isn’t being displayed. If you run a print(m,':',s) in your repeat loop, then its possible the minutes and seconds decrement as expected.

But right here, you only set numberValues. Not any type of text that might be shown on a UI object.

script.Parent.Text.Timer.Seconds.Value = s
script.Parent.Text.Timer.Minutes.Value = m

Some code which would update a text label, every time a numberValue’s value changes would look like:

numberValue.Changed:Connect(function (val)
    textLabel.Text = val
end)
1 Like