Ok here's the deal. With tools, you need this:
script.Parent.Parent.Parent. So here:
bin = script.Parent
local pack = bin.Parent.Parent.Backpack
local player = pack.Parent
local char = game.Workspace:findFirstChild(player.Name)
function onButton1Down(mouse)
mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
local hit = mouse.Target
if (hit == nil) then return end
if (hit.Name == "Toy_Hammer") then
game.Workspace.Toy_Hammer:Clone().Parent = player
end
if (hit.Name == "Lightsaber") then
game.Workspace.Lightsaber:Clone().Parent = player
end
--MORE
mouse.Icon = "rbxasset://textures\\GunCursor.png"
end
function onSelected(mouse)
print("Action Tool Selected")
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
bin.Selected:connect(onSelected) |