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.

2 comments
Thanks, but could you tell me why?
@DERP9487 When you make function you will need () but when you use :Connect() you don't need it.