Is this code inside another function?
If so then it would only recognize .Changed if it was changing at that exact moment the section of code is running.
Can you include a bit more context? like how are you changing the value, and what other things are going on within the script where the connection is made?
Here’s the full code.
Sorry I was sleeping btw.
The value is changed to true when a player buys something.
local service = game:GetService("DataStoreService")
local geardata = service:GetDataStore("q35t3626notherealone")
game.Players.PlayerAdded:Connect(function(plr)
script.Parent.Value = geardata:GetAsync(plr.UserId) or false
print(script.Parent.Value)
print("gotten async")
task.wait()
if script.Parent.Value == true then
plr.PlayerGui:WaitForChild("Shop").Items.Placeholder.Purchased.Purchase:Fire()
print("purchased")
end
script.Parent.Changed:Connect(function()
print("changed")
geardata:SetAsync(plr.UserId, script.Parent.Value)
end)
end)