LocalScript==>named as==> LocalManager
local TutorialManager = {}
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local tutorialFolder = ReplicatedStorage:WaitForChild("PlayerTutorial")
local TutorialEndEvent = tutorialFolder:WaitForChild("TutorialEnd")
local NextGoalEvent = tutorialFolder:WaitForChild("NextGoal")
-- Note Goal parts must be ordered in the table, or else Goal order may be different in-game
local goalParts = {
workspace.TutorialGoals.GoalPart1,
workspace.TutorialGoals.GoalPart2
}
local function checkTutorialEnd(player, goalParts)
local currentIndex = player:WaitForChild("GoalProgress")
return currentIndex.Value >= #goalParts
end
local function finishTutorial(player)
local playerBeam = player.Character.HumanoidRootPart:FindFirstChildOfClass("Beam")
playerBeam:Destroy()
print(player.Name .. " finished the tutorial")
-- Placeholder for further code. E.g. if you wanted to send messages to the server to do other tasks
end
function TutorialManager.interactGoal(player)
NextGoalEvent:FireServer()
end
function TutorialManager.getTutorialGoals()
return goalParts
end
function TutorialManager.nextGoal(player, goalParts)
if checkTutorialEnd(player, goalParts) then
finishTutorial(player)
else
-- Increment the player's Goal tracker
local currentGoalIndex = player:WaitForChild("GoalProgress")
currentGoalIndex.Value += 1
end
end
-- Creates an int value to locally track player's progress through the tutorial Goals
function TutorialManager.setupPlayerProgress(player)
local currentGoalProgress = Instance.new("IntValue")
currentGoalProgress.Name = "GoalProgress"
currentGoalProgress.Value = 1
currentGoalProgress.Parent = player
end
return TutorialManager
https://www.roblox.com/library/303835976/ParticleEmitter-Emit-n-V2