if maps.ObbyLevels:FindFirstChildWhichIsA("Model") then
print("model found")
end
Try that to see if you are looking for the correct model, if it does not print, then you are looking for the wrong thing.
if maps.ObbyLevels:FindFirstChildWhichIsA("Model") then
print("model found")
end
Try that to see if you are looking for the correct model, if it does not print, then you are looking for the wrong thing.
there’s only one model in the folder and i know that works because parts in the script reference that same exact area and it works, thanks though
Make an Table, where every user is listed in, and when someone touches the Part, check if the player is already in the table. If not, add the player To the table and do your stuff. At the end of a round, just clear the table
maps
are in replicated storage and FinishedPart gets cloned and parented to workspace right?
yes, inside the ObbyLevels folder, FinishedPart inside the map model
So does the variable maps take you to replicated storage or to game.Workspace?
If it takes you to replicated storage, that means that the event is not registered on the correct part. It should register on the part in game.Workspace.
i see, Touched event will fire only if the original one is touched change the code to
local function GameplayCountdown()
countdownV.Value = gameplayTime
gameStatus.Value = "In game"
local Connection
Connection = FinishedPartClone.Touched:Connect(function()
countdownV.Value = countdownV.Value - 10
end)
while countdownV.Value >= 0 do
countdownV.Value += -1
task.wait(1)
end
Connection:Disconnect()
end
maps is a folder in workspace, the path is correct im 100% certain it is
its serverstorage my bad, not replicatedstorage - i dont get it though, why does it work in other sections of my script for other things, and not here?
Do you clone the FinishedPart inside your code?
the map is cloned, which is the model that houses FinishedPart
local map1Clone = SS.LevelStorage.ObbyLevels:FindFirstChild(map1Name):Clone()
map1Clone.Parent = workspace.MapInGame
map1Clone:MoveTo(workspace.MapSpawnArea.Position)
works fine, no problems and the touched events for FinishedPart in other sections of my script is also fine with no issues which is weird
FinishedPart.CanTouch
is set to true
?
yes CanTouch is set to true for FinishedPart
could you send full code so i will see what is wrong
local function Countdown()
print("COUNTDOWN")
while wait() do
for i = intermissionTime, 1, -1 do
gameStarted.Value = false
wait(1)
gameStatus.Value = "Intermission" -- can change to something more creative later
countdownV.Value = i
end
task.wait(1)
GameplayCountdown()
print("gameplayCountdownCalled")
--for i = gameplayTime, 1, -1 do
-- gameStarted.Value = true
-- wait(1)
-- countdownV.Value = i
-- gameStatus.Value = "In game" -- can change to something more creative later
--end
end
end
local function GameplayCountdown()
print("recGPCOUNT")
--local connectionDB = false
--local mapF = maps.ObbyLevels:FindFirstChildWhichIsA("Model")
--local finishedPart = mapF:WaitForChild("FinishedPart")
countdownV.Value = gameplayTime
gameStatus.Value = "In game"
local Connection
--Connection = maps.ObbyLevels:FindFirstChildWhichIsA("Model").FinishedPart.Touched:Connect(function()
Connection = maps.ObbyLevels:FindFirstChildWhichIsA("Model").TestPart.Touched:Connect(function()
print("touched countdown")
--if connectionDB == false then
--connectionDB = true
print("countdownAdjust")
countdownV.Value = countdownV.Value - 10
-- task.wait(0.05)
--connectionDB = false
--end
end)
This is where the function is called, rest of the script is kind of irrelevant to the problem as the touched event for the same FinishedPart in other sections of the script is fine. I tried some things but everything there didn’t work -
print("recGPCOUNT")
prints fine, only thing in the function that does
total script is like 400 lines so dont really want to send here
GameplayCountdown()
is yielding function which means print()
will work after the countdown
after connecting function to the Touched
event print(TestPart.Parent)
also maps
is a cloned map?
omg i figured that part out now, i made an error, but the timer goes to negatives still, need a debounce right?
the Countdown()
function or GameplayCountdown()
goes to negative?
the value mentioned inside GameplayCountdown() - countdownV
GOT IT WORKING THANK U SO MUCH
local function Countdown()
print("COUNTDOWN")
while wait() do
gameStarted.Value = false
gameStatus.Value = "Intermission" -- can change to something more creative later
for i = 0, intermissionTime do
countdownV.Value = intermissionTime - i
task.wait(1)
end
task.wait(1)
GameplayCountdown()
print("gameplayCountdownCalled")
--for i = gameplayTime, 1, -1 do
-- gameStarted.Value = true
-- wait(1)
-- countdownV.Value = i
-- gameStatus.Value = "In game" -- can change to something more creative later
--end
end
end
fix the Countdown() function and add print(countdownV.Value) inside GameplayCountdown()