#It for some reason does not detect when I touch timeStop

56 messages · Page 1 of 1 (latest)

amber laurel
#

No one absolutely no one can figure this out?

trim cipherBOT
#

studio** You are now Level 3! **studio

fallen hound
#

Any errors?

amber laurel
#

nope

#

It's like the function isn't even there

fallen hound
#

Do a print in every function to see which one is not running

amber laurel
#

Gotchu

#

I'll get back with the results

#
local player = game.Players.LocalPlayer
local button = script.Parent.Button
local timerLabel = script.Parent.TimerLabel
local spawnLocationPart = workspace:WaitForChild("SpawnLocation")
local timeStopPart = workspace:WaitForChild("timeStop")

local timer = 0
local counting = false

local function updateTimerLabel()
    local minutes = math.floor(timer / 60)
    local seconds = math.floor(timer) % 60
    local milliseconds = math.floor((timer - math.floor(timer)) * 1000)
    print("UpdateTimerLabel Functions working")
    timerLabel.Text = string.format("%02d:%02d:%03d", minutes, seconds, milliseconds)
end

local function startTimer()
    counting = true
    timerLabel.Visible = true
    print("StartTimer Functions working")
    while counting do
        timer = timer + (1/60)
        updateTimerLabel()
        wait(1/60)
    end
end

local function stopTimer()
    counting = false
    print("StopTimer Functions working")
end

local function onButtonClicked()
    player.Character:SetPrimaryPartCFrame(spawnLocationPart.CFrame)

    timer = 0
    startTimer()
    print("OnButtonClick Functions working")
end

button.MouseButton1Click:Connect(onButtonClicked)

player.CharacterAdded:Connect(function(character)
    character:WaitForChild("HumanoidRootPart").Touched:Connect(function(part)
        print("Line 47")
        if part == timeStopPart then
            stopTimer()
            print("Line 48")
        end
    end)
end)
#

Is this what you meant?

fallen hound
#

So does the timer works? Like you see the time going up?>

amber laurel
#

Yes

#

But it never stops when I touch the stop part

fallen hound
#

Line 47 and line 48 never gets printed, there is your problem

amber laurel
#

Yes

#

But whats the solution haha

fallen hound
#
local char = plr.Character or plr.CharactedAdded:Wait()
part.Touched:Connect(function(hit)
  if hit.Parent == char then
    stopTimer()
  end
end)
#

Try this

amber laurel
#

will do

#

quick question

#

Bit new to this

#

Where do I place that?

fallen hound
#

Ummm... Replace it with

player.CharacterAdded:Connect(function(character)
    character:WaitForChild("HumanoidRootPart").Touched:Connect(function(part)
        print("Line 47")
        if part == timeStopPart then
            stopTimer()
            print("Line 48")
        end
    end)
end)
amber laurel
#

nothing

fallen hound
#

Did you used any print()?

amber laurel
#

yes

#

Exact same print code thingy majigs as before, but with your modification

fallen hound
#

Do a print to char

amber laurel
#

could you be a bit more specific?

#

I'm a bit slow on the south side

fallen hound
#

Right before you made the variable char do a print(char)

amber laurel
#

I might also be a bit slow on the west side

fallen hound
#
local char = plr.Character or plr.CharactedAdded:Wait()

-->>>>>>
print(char)
-->>>>>>

part.Touched:Connect(function(hit)
  if hit.Parent == char then
    stopTimer()
  end
end)
amber laurel
#

not to be him but can you do it for me since I'm still a bit slow on the north side

fallen hound
#

omg... Just print(char)

amber laurel
#

Not my proudest moment

fallen hound
#

I literally can't say anything more... Is that simple..

amber laurel
#

so just print(char) anywhere?

fallen hound
#

Preferably under the variable char

amber laurel
#

mhm

#

what if I told you I don't have a local char?

trim cipherBOT
#

studio** You are now Level 4! **studio

fallen hound
#

....... ?

amber laurel
#

You got the wrong code

amber laurel
#

mb

#

I didn't update it correctly

amber laurel
#

I didn't realize

amber laurel
#

Not my produest moment

#

Proudest

fallen hound
#

So all fixed?

amber laurel
#

yeah sure

fallen hound
#

Good