|
| 28 Aug 2012 06:25 PM |
My last few threads didn't help that much so here: Why does this script make me spawn Cframed in the middle of the map when I equipped the tool? Do I have to identify the position of the part?
local equip = false local Tool = script.Parent
_G.waitForChild = (function (instance, child)
repeat wait() until instance:findFirstChild(child) ~= nil
return instance:findFirstChild(child)
end)
function Equipped(mouse)
wait()
equip = true
follow(mouse)
end
function follow(mouse)
part = Instance.new("Part", Tool.Parent) part.Name = "MousePart" part.Transparency = 1 part.Anchored = false part.CanCollide = false part.FormFactor = "Symmetric" part.Size = Vector3.new(1, 1, 1)
local weld = Instance.new("Weld", part) weld.Part0 = part weld.Part1 = Tool.Parent.Torso weld.C0 = CFrame.new(0, -1.5, 0)
local head = Tool.Parent.Head
while equip == true do
weld.C0 = (CFrame.new(head.CFrame.p, mouse.Hit.p) - head.CFrame.p):inverse() * (head.CFrame - head.Position) * CFrame.new(0, -1.5, 0)
wait()
end
end
function Unequipped()
equip = false part:Destroy()
end
Tool.Equipped:connect(Equipped) Tool.Unequipped:connect(Unequipped) |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2012 06:31 PM |
| Bump... Sigh here we go again.. |
|
|
| Report Abuse |
|
|
agent767
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 4181 |
|
|
| 28 Aug 2012 06:47 PM |
Did you anchor the handle of the tool? And don`t expect a reply after only 6 minutes. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2012 06:49 PM |
| Wait a sec I dont think so why? |
|
|
| Report Abuse |
|
|
agent767
|
  |
| Joined: 03 Nov 2008 |
| Total Posts: 4181 |
|
|
| 28 Aug 2012 06:55 PM |
"Cframed in the middle of the map when I equipped the tool?" This happens when you anchor the handle or a part welded to it. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 29 Aug 2012 07:51 AM |
Like I said last time, Inverse the Part0 and Part1, including the C0 and C1 |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 07:54 AM |
| OH!!! I didnt Switch C0 and C1! I will try that right now.. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 07:55 AM |
Sorry I didn't make that clear, I figured you might notice. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 08:10 AM |
| I still spawn in the middle of the map... Well actually on theis llittle green baseplate below it.. I miswell just give you the two scripts casue I have no clue why it's still teleporting me.. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 08:24 AM |
local weld = Instance.new("Weld", part) weld.Part1 = part weld.Part0 = Tool.Parent.Torso weld.C1 = CFrame.new(0, -1.5, 0)
local head = Tool.Parent.Head
while equip == true do
weld.C1 = (CFrame.new(head.CFrame.p, mouse.Hit.p) - head.CFrame.p):inverse() * (head.CFrame - head.Position) * CFrame.new(0, -1.5, 0)
wait()
end
end |
|
|
| Report Abuse |
|
|
QIB
|
  |
| Joined: 27 Nov 2010 |
| Total Posts: 45 |
|
|
| 29 Aug 2012 08:44 AM |
| Is the part positioned at your head or torso? |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 08:49 AM |
| No.. I dont think so how would I do that? |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 09:07 AM |
| part.Position = Torso.Position? |
|
|
| Report Abuse |
|
|
| |
|