Hey Roblox devs. I’m making an objective system in my game, and I came across a problem.
local ArrowEvent = game.ReplicatedStorage.ArrowEvent
game.Players.PlayerAdded:Connect(function(player)
local GeneralMurphy = game.Workspace.NPCs["General Murphy"].HumanoidRootPart
local GunCrates = game.Workspace["Millitary Plane"].Crates["Military Crates"].ak47gmod
wait(1)
while true do
if player.CurrentObjective.Value == "•Talk to General Murphy" then
print("passed general murphy")
ArrowEvent:FireAllClients(GeneralMurphy, true)
elseif player.CurrentObjective.Value == "•Choose Weapons" then
print("passed chooose weapons")
ArrowEvent:FireAllClients(GunCrates, true)
end
wait()
end
end)
When a player spawns in, they automatically get a string value named “CurrentObjective.” This string represents the players current objective in the game, and changes as they complete tasks. What I’m trying to do in this script is fire an event which activates arrows pointing to where the objective is.
Now, the real problem is when the CurrentObjective value changes, it doesn’t print “passed choose weapons” for whatever reason. You can see the if statement that I have written down. It should recognize the value changing, but it doesn’t.
If someone could tell me what is wrong it would really help me out.