So I’m trying to create a task/mission system using events, and in this RemoteEventHandler script, in the AssignMissionEvent OnServer event function, it only works up to setting the Active Value true, it doesn’t print that it was set to true and any code I have after it doesn’t work or respond, and there’s no errors in the output coming from this script. I’ve tried multiple other ways such as WaitForChild() and printing messages for any errors.
local Services = {
ReplicatedStorage = game:GetService("ReplicatedStorage"),
ServerStorage = game:GetService("ServerStorage"),
ReplicatedFirst = game:GetService("ReplicatedFirst"),
Market = game:GetService("MarketplaceService"),
DataService = game:GetService("DataStoreService"),
UIS = game:GetService("UserInputService"),
Players = game:GetService("Players"),
Badge = game:GetService("BadgeService"),
}
local GameBadges = {
Support = 2143451532,
Robbery = 2143503899,
}
local Essential = {
Filter = workspace:WaitForChild("Filter"),
Npcs = workspace:WaitForChild("Filter"):WaitForChild("Npcs"),
}
local TaskRelated = Essential.Filter:WaitForChild("TaskRelated")
local TaskEssentials = {
MailBoxes = TaskRelated:WaitForChild("Mailboxes_A"),
UsedVal = TaskRelated:WaitForChild("Mailboxes_A"):WaitForChild("Used"),
}
Services.ReplicatedStorage.AssignMission.OnServerEvent:Connect(function(plr)
print("AssignEvent has been activated.")
local MissionValues = plr:FindFirstChild("MissionValues") or plr:WaitForChild("MissionValues")
if MissionValues and MissionValues:FindFirstChild("Active") then
plr.MissionValues.Active.Value = true
print("Active set to true.")
else
print("MissionValues or Active value not found.")
end
end)
Services.ReplicatedStorage:WaitForChild("UiEvents").ReturnManager.OnServerEvent:Connect(function(plr, manager)
local Manager = Essential.Npcs:FindFirstChild(manager)
if Manager then
local name = Manager.Name
Services.ReplicatedStorage.UiEvents.SendManager:FireClient(plr, name)
end
end)