I am screwing around. But I can't seem to fix this problem. The script below doesn't pull the player when you point at anchored parts. This is like a grapple gun and it slowly pulls you in. Here is the script: (The comments are code that didn't work, but might need later)
Player = game.Players.LocalPlayer
PlayerMouse = Player:GetMouse()
PlayerMouse.Button1Down:Connect(function()
local ClickPosition = PlayerMouse.Hit.p
local PlayerCharactor = game.Workspace[Player.Name]
local ClickTarget = PlayerMouse.Target
local Attachment0 = Instance.new("Attachment")
Attachment0.Parent = ClickTarget
Attachment0.WorldPosition = ClickPosition
local Attachment1 = game.Workspace[Player.Name].RightHand.RightGripAttachment
game.Workspace.MakeRope["Attachment0"].Value = Attachment0
game.Workspace.MakeRope["Attachment1"].Value = Attachment1
local RopeConstraint = require(game.Workspace.MakeRope)
local MakeRopeClone = game.Workspace.MakeRope:Clone()
game.Workspace.MakeRope:Destroy()
MakeRopeClone.Parent = game.Workspace
PlayerCharactor.Health.Disabled = true
local WeldConstraint = Instance.new("WeldConstraint")
WeldConstraint.Part0 = game.Workspace[Player.Name].RightHand
WeldConstraint.Part1 = game.Workspace[Player.Name].RightLowerArm
PlayerCharactor.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
for index, PlayerObject in pairs(PlayerCharactor:GetDescendants()) do
if PlayerObject.ClassName == "Motor6D" then
local BallSocketConstraint = Instance.new("BallSocketConstraint")
local Part0 = PlayerObject.Part0
local Part1 = PlayerObject.Part1
--local C0 = CFrame.PointToWorldSpace(PlayerObject.C0)
--local C1 = CFrame.PointToWorldSpace(PlayerObject.C1)
--local Attachment02 = Instance.new("Attachment", Part0)
--local Attachment12 = Instance.new("Attachment", Part1)
--Attachment02.Position = C0
--Attachment12.Position = C1
local success, errors = pcall(function()
BallSocketConstraint.Attachment0 = Part0[PlayerObject.Name.."RigAttachment"]--Attachment02
BallSocketConstraint.Attachment1 = Part1[PlayerObject.Name.."RigAttachment"]--Attachment12
end)
if success then
BallSocketConstraint.Parent = PlayerObject.Parent
--PlayerObject.Enabled = false
end
end
end
--local Humanoid = PlayerCharactor.Humanoid:Clone()
--Humanoid.Parent = script
--PlayerCharactor["Humanoid"]:Destroy()
local Stop = false
repeat
RopeConstraint.Length = RopeConstraint.Length-0.2
wait(0.001)
PlayerMouse.Button1Up:Connect(function()
Stop = true
end)
until Stop == true
PlayerCharactor.Humanoid:ChangeState(Enum.HumanoidStateType.Freefall)
RopeConstraint:Destroy()
--local Humanoid = script["Humanoid"]:Clone()
--Humanoid.Parent = PlayerCharactor
--script["Humanoid"]:Destroy()
for index, PlayerObject in pairs(PlayerCharactor:GetDescendants()) do
if PlayerObject.ClassName == "Motor6D" then
PlayerObject.Enabled = true
elseif PlayerObject.ClassName == "BallSocketConstraint" then
PlayerObject:Destroy()
end
end
end)
This is located in StarterPlayerScripts
