So, I'm okay at scripting not the best. This is a re-post because my other anwsers just didn't work. Anyways here's the script I need help with.
local playerModel = script.Parent local humanoid = playerModel:WaitForChild("Humanoid") local userInputService = game:GetService("UserInputService") local partA = playerModel.HumanoidRootPart local attachmentA = Instance.new("Attachment",partA) local attachmentAPos = attachmentA.Position attachmentAPos = Vector3.new(0,0,-1) local partB = script.Parent.RightHand local attachmentB = Instance.new("Attachment",partB) local attachmentBPos = attachmentB.Position attachmentBPos = Vector3.new(0,0,-1) humanoid(function(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid").Died:Connect(function() if humanoid.Health >= 0 then local distance = (partA.Position - partB.Position).magnitude if distance == 10 then userInputService.InputBegan:Connect(function(input, gameProcessedEvent) if input.UserInputType == Enum.UserInputType.Keyboard then if input.InputKeycode == Enum.KeyCode.E then local rodConstraint = Instance.new("RodConstraint",partA) rodConstraint .Attachment0 = attachmentA rodConstraint .Attachment1 = attachmentB end end end) end end end) end) end)
It says Workspace.darkkitten12345.LocalScript:15: attempt to call a Instance value. I REALLY need help on this, thank you.
The error means you are attempting to treat an instance as a function. In this case, you are treating your humanoid as a function:
humanoid(function(player) player.CharacterAdded:Connect(function(character)
The code which is giving the error in that line specifically is:
humanoid(function(player)
The opening bracket after the variable signifies to the code interpreter that you are attempting to call a function, and because an instance can't act as a function, the error is thrown.
I am not entirely sure what you are trying to do with the erroring code, but there is a list of events and methods that belong to the humanoid which can be found here.
If you have any further questions or errors, feel free to message me on Discord
(phxntxsmic#2021)
local attachmentA = Instance.new("Attachment",partA) local attachmentAPos = attachmentA.Position attachmentA.Parent = "insert parent here"
You forgot to parent the attachment somewhere, thats why its causing an error