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

Passed value is not a function but still doesn't work?

I have been reading many articles, and I have no idea what happened to my script.

I know what is "Passed value is not a function"

It means you cannot call a function that hasn't been defined yet.

I tried to solve, but it still acts the same.

This is my code:

local Char = script.Parent
repeat wait() until Char:FindFirstChildWhichIsA("Humanoid")
function OnDeathR15()
local Vars = Char:GetDescendants()
for index,var in pairs(Vars) do
	if var.ClassName == "Motor6D" then
		local Part0 = var.Part0
		local Part1 = var.Part1
		local Constraint = Instance.new("BallSocketConstraint")
		Constraint.Parent = Char
		--Set fake joint(But realistic!)
		Constraint.LimitsEnabled = true
		Constraint.TwistLimitsEnabled = true
		Constraint.UpperAngle = 45
		Constraint.TwistLowerAngle = -45
		Constraint.TwistUpperAngle = 45
		--Set Attachments
		local Attach0 = Instance.new("Attachment")
		local Attach1 = Instance.new("Attachment")
		Attach0.Name = "Attach0"
		Attach1.Name = "Attach1"
		Attach0.Parent = Part0
		Attach1.Parent = Part1
		--Weld two part to a JOINT
		Constraint.Attachment0 = Attach0
		Constraint.Attachment1 = Attach1
	end
end
end
Char:FindFirstChildWhichIsA("Humanoid").Died:Connect(OnDeathR15()) -- I think this is the error.

Sincerely, DERP9487.

1 answer

✓ Accepted answer

Use OnDeathR15 without ()

Char:FindFirstChildWhichIsA("Humanoid").Died:Connect(OnDeathR15)

2 comments

0

Thanks, but could you tell me why?

0

@DERP9487 When you make function you will need () but when you use :Connect() you don't need it.

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