Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- SETTINGS
- local RunService = game:GetService("RunService")
- -- SCRIPT
- function Use(...)
- local args = {...}
- local Range = 50
- local p = Instance.new("Part")
- p.CanCollide = false
- p.Anchored = true
- p.Parent = workspace
- p.Position = args[1].Torso.Position
- -- part creation and stuff would go hear
- -- *here
- -- vvvvvvv thats the part i meade
- for _, plr in pairs(game.Players:GetPlayers()) do
- if plr.Character:FindFirstChild("Torso") and args[1].Character:FindFirstChild("Torso") then
- if (args[1].Character.Torso.Position - plr.Character.Torso.Position).magnitude <= Range then
- coroutine.wrap(function()
- local attachment0 = Instance.new("Attachment")
- local f = Instance.new("VectorForce")
- f.ApplyAtCenterOfMass = true
- f.Force = 1000/(plr.Character.Torso.Position - args[1].Character.Torso.Position)
- -- Comment the above line and uncomment the below line for
- -- constant force regardless of distance
- -- f.Force = plr.Character.Torso.Position - args[1].Character.Torso.Position
- -- f.Force.Magnitude = whatevernumberlol
- f.Attachment0 = attachment0
- attachment0.Parent = plr.Character.Torso
- f.Parent = attachment0
- repeat
- plr.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, true)
- until plr.Character.Humanoid:GetState() == "Seated"
- local mytick = 0
- local con
- con = RunService.Heartbeat:Connect(function()
- mytick += 1
- if mytick > 7 then -- 7 frames
- attachment0:Destroy()
- if f then f:Destroy() end -- how to demolish the games memory :troll:
- con:Disconnect()
- end
- end)
- end)()
- end
- end
- end
- end
- return Use
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement