.Changed not working?

messages twice (for both values when they appear i guess) but doesn’t pick up any value changes.

local https = game:GetService("HttpService")
local url = no.
game.Players.PlayerAdded:Connect(function(plr)
	local folder = plr:WaitForChild("leadstats")
	local nights = folder.nights
	local maxmode = folder.maxmode
	local function senderror(plr)
		warn("Actually connected lol")
	local message = "Data change ".. plr.UserId.."/"..plr.Name.. " ".. "nights: "..nights.Value.. " maxmode: ".. tostring(maxmode.Value) --gets defined later so by the time the webhook sends it should be defined
	local info = {
		["embeds"] = {{
			["title"] = "Data change",
			["description"] = message
		}}
	}
	local encrpyted = https:JSONEncode(info)
	https:PostAsync(url, encrpyted)
	end
	for _, vals in pairs(folder:GetChildren()) do
		warn("For loop happened")
		vals.Changed:Connect(senderror(plr))
		warn	("Connected")
	end
end)

I don’t believe that your function’s params are properly being sent through. Trying following the paradigm used in this SO thread:

they are. the message works.
image
it just doesn’t fire.
or i misunderstood

This should be:

vals.Changed:Connect(function()
    senderror(plr)
end)

You are currently calling the function immediately, and connecting to the return value of that (nil).

3 Likes

thanks roblox staff me- wait what? also again thanks, i’ll try it now!

Thanks a lot! it worked! it’s nice seeing staff helping people. Makes the forums lively!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.