It keeps showing Workspace.darkkitten12345.LocalScript:11: attempt to call a Instance value. I'm also worried that it might just not work. I know how to code a little but it's quite confusing at times.
Local script - SCS
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 attachmentAPostition = Vector3.new(0, 0, -1) local partB = script.Parent.RightHand local attachmentB = Instance.new("Attachment",partB) local attachmentBPostition = 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)
Any way to fix it?
You cant change a value with local try creating a variable for the position of attachmentA like local attachmentAPos = attachmentA.Position and then doing attachmentAPos = Vector3.new(0,0,-1) then again ive never really used constraints and im not sure if they have Positions but you can try it out
You changed a variable that didnt exist basically