Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Attempt to connect failed: Passed value is not a function ?

Hello i'm working on a battle royale game but there's an error on my Display Manager module script:

 local DisplayManager = {}

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local displayvalues = ReplicatedStorage:WaitForChild("DisplayValues")
local status = displayvalues:WaitForChild("Status")
local playersLeft = displayvalues:WaitForChild("PlayersLeft")
local timeLeft = displayvalues:WaitForChild("TimeLeft")

local function updateRoundStatus()
	status.Value = "Players Left: "..playersLeft.Value.." / Time Left: "..timeLeft.Value
end

function DisplayManager.updateStatus(newStatus)
	status.Value = newStatus
end

playersLeft.Changed:Connect(updateRoundStatus())
timeLeft.Changed:Connect(updateRoundStatus())
return DisplayManager

2 comments

0

Try GetPropertyChangedSignal

0

Could we get the line the error occured on?

1 answer

Here are two solutions

playersLeft.Changed:Connect(updateRoundStatus) -- remove the extra parentheses
timeLeft.Changed:Connect(updateRoundStatus) -- same thing here

If that doesn't work, spread them out:

playersLeft.Changed:Connect(function()
	updateRoundStatus()
end)

timeLeft.Changed:Connect(function()
	updateRoundStatus()
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.