Kalze
|
  |
| Joined: 24 Jun 2009 |
| Total Posts: 27 |
|
|
| 24 Dec 2012 06:34 PM |
So, I want to the Backpack tool to work, when it is placing an item, the item would be perfectly aligned and you could rotate it like with the grab tool (no tilt needed). However, the annoying lua strikes again and produces some errors.
The lua: -- Line98 VV function do_rotate(example, center, new) if example:IsA("BasePart") then example.CFrame = new:toWorldSpace(center:toObjectSpace(object.CFrame)) end end
function onKeyDown(key, mouse) if key == "r" then local center = example.GetCFrame() local rotated = center * CFrame.Angles(0, math.pi / 2, 0)
do_rotate(center, rotated, false) on_mouse_move(mouse) elseif key == "e" then local player = TOOL.Parent.Parent local pack = player:findFirstChild("Pack") local pack_tab = pack:GetChildren()
for index, child in pairs(pack_tab) do CURRENT = child onButton1Down(mouse) wait(0.1) end
CURRENT = nil elseif key == "q" then removeExample() CURRENT = nil end
update() end
-- Line 161 VV function onSelected(mouse) mouse.Button1Down:connect(function() onButton1Down(mouse) end) mouse.Move:connect(function() onMouseMove(mouse) end) mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
local player = TOOL.Parent.Parent local playerGui = player.PlayerGui
playerGui.ScreenGui.Other.Visible = true
update() end And the error:
02:33:27 - Players.Player1.Backpack.Backpack.LocalScript:100: attempt to index global 'example' (a nil value) 02:33:27 - Script "Players.Player1.Backpack.Backpack.LocalScript", Line 100 - global onKeyDown 02:33:27 - Script "Players.Player1.Backpack.Backpack.LocalScript", Line 164 02:33:27 - stack end 02:33:27 - Disconnected event because of exception |
|
|
| Report Abuse |
|
Kalze
|
  |
| Joined: 24 Jun 2009 |
| Total Posts: 27 |
|
|
| 24 Dec 2012 07:57 PM |
| As such, Im still waiting for a response.. |
|
|
| Report Abuse |
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 24 Dec 2012 07:58 PM |
| local center = example.GetCFrame() -- You never defined example, and it's :GetModelCFrame() |
|
|
| Report Abuse |
|