Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm making a dead body dragging but it's not working?

Asked by 3 years ago
Edited 3 years ago

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?

0
I'm now having the problem "humanoid is not a valid member of DataModel "Normal highschool @ 24 Jun 2021 11:55" On line13 darkkitten12345 8 — 3y
0
New problem, Workspace.darkkitten12345.LocalScript:12: attempt to call a Instance value darkkitten12345 8 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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

0
Do the same for attachmentB Quicknoodle 2 — 3y
Ad

Answer this question