Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is this positioning possible?

Asked by 8 years ago

Hello, I have here my upgrade insertskateboard script, now say if I used an anchored model, it will be placed directly by the Torso due to "Torso" and the position. Now, is there a way to get the model to be placed on the ground? I have tried to use "Left leg" or "Right leg" but, the model (asset) will not appear. could someone help me through this?

-- Script:

ids = {} 

local Tool = script.Parent;


function insert()
    local randID = ids[math.random(#ids)] --#ids is the number of values in the table
    local root = game:GetService("InsertService"):LoadAsset(randID) --Load the random ID.


    local instances = root:GetChildren()
    if #instances == 0 then
        root:Remove()
        return
    end

    --Continue the insert process
      root.Name = "InsertedObject" .. randID
    game:GetService("InsertService"):Insert(root)
    local t = game.Players.LocalPlayer.Character:FindFirstChild("Left leg")
    if t == nil then return end --Make sure that the script doesn't error if the torso is not found
    root:MoveTo(t.Position + t.CFrame.lookVector * 8)
    Tool.Handle.Drop:Play()

end



enabled = true
function onButton1Down(mouse)
    if not enabled then
        return
    end

    enabled = false


    insert()
    wait(.01)

    Tool:Remove()


end

function onEquippedLocal(mouse)

    if mouse == nil then
        print("Mouse not found")
        return 
    end

    mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end


Tool.Equipped:connect(onEquippedLocal)

1 answer

Log in to vote
0
Answered by 8 years ago

Oh on the end of line 20, I didn't change it back to "Torso", still the same problem.

Ad

Answer this question