What do you want to achieve? I am trying to get the player to collide with the part, have the part switch to another (pre-planed) part, and repeat until all parts have been touched.
What is the issue? No errors in output, all of the debug print statements are fine, but the player never checks if it collided with the secondary part. I don’t know if I have to setup a separate detection for each of these, (I don’t want to do that because it would just be less complicated if I had it all in one).
What solutions have you tried so far?
I have tried making a clone of a script and sending data through remote events, but it was very slow & hard to maintain. I switched to having it in the main client script, but the code will not detect any part after the first part.
my location storage: (yes I know its unoptimized/messy)
(all of them are object values)
(this code is my entire script. Just to make sure nothing else is messing it up)
local plr = game:FindService("Players").LocalPlayer plr:WaitForChild("leaderstats") plr.PlayerGui:WaitForChild("Tutorial") local age = plr.leaderstats.Age local sub = plr.SubStat local part = 1 local debounce = false local currentTask = game:FindService("ReplicatedStorage").Tasks:FindFirstChild("Age" .. age.Value):FindFirstChild(sub.Value) local currentLocation = currentTask.Locations:FindFirstChild("Part" .. part) local currentText = currentTask.TXT local text = plr.PlayerGui.Tutorial.CanvasGroup.TextLabel repeat task.wait() print("Waiting") until currentLocation.POS.Value ~= nil print("Wait ended") local destination = game:FindFirstChild(tostring(currentLocation.POS.Value), true) function refresh() currentTask = game:FindService("ReplicatedStorage").Tasks:FindFirstChild("Age" .. age.Value):FindFirstChild(sub.Value) currentLocation = currentTask.Locations:FindFirstChild("Part" .. part) currentText = currentTask.TXT debounce = false destination = game:FindFirstChild(tostring(currentLocation.POS.Value), true) end coroutine.resume(coroutine.create( function() for i = 1, #currentText.Value do text.Text = string.sub(currentText.Value, 1, i) task.wait() end end)) destination.Touched:Connect(function() if debounce == false then if currentLocation.Parent:FindFirstChild("Part" .. tostring(tonumber(part) + 1)) then --last = part part = part + 1 refresh() else part = 1 end debounce = true print("Touched, " .. part) end end)
I will send any info needed to fix these!