Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 26 Dec 2012 11:43 PM |
So I have this huge, uncollidable cylinder that I'm trying to get to pull the user upwards when they touch it.
Velocity isn't working, and I want to use bodypositions as a last resort.
Any ideas? |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 27 Dec 2012 12:10 AM |
Okay, so I culminated this. It's messy, but will it work?
function indexiveMass(targ) local m = 0 local c = node:GetChildren() for i = 1,#c do if c[i].className == "Part" then m = m + c[i]:GetMass() end m = m + indexiveMass(c[i]) end return m end
function pullPlayer(hit) hume = game.Players:findFirstChild(hit.Parent.Name) if hume and not hume.Character.Torso:findFirstChild("RisingForce") then
local pullforce = Instance.new("BodyForce") pullforce.Name == "RisingForce" pullforce.force = Vector3.new(0, indexiveMass(hit.Parent)*198.6, 0) --OVERCOMING GRAVITEEEEE pullforce.Parent = hit.Parent["Torso"] wait() end end
function removeForce(hit) hume = game.Players:findFirstChild(hit.Parent.Name) if hume and hume.Character.Torso:findFirstChild("RisingForce") then hume.Character.Torso.RisingForce:destroy() end end
script.Parent.Touched:connect(pullPlayer) script.Parent.TouchEnded:connect(removeForce)
|
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 27 Dec 2012 12:19 AM |
Okay, so that worked perfectly.
Thanks, SH, you've once again solved my problems through divine ignorance. |
|
|
| Report Abuse |
|
|