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

I want to make a mannequin try on script, how? [closed]

Asked by 2 years ago

So i'm working on a homestore and I have a try on, on the starter pack. basically if you equip it and click on any mannequin, it makes you wear the shirt and if u press q u try the pants, which means only pc players can try on the pants. I want a script that makes you try on the shirt/pants on the mannequin, and works in mobile/ipad/pc,etc. please help????????

Closed as Not Constructive by JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
omorizz 50
2 years ago

hi! i've done this with my homestore. (i didn't make this script, nikilis did, but it works!)

--Settings--
RemoveClothesWhenToolDeselected = false -- This takes off clothes that have been tried on if the player deselects the tool.
------------






repeat wait() until game.Players.LocalPlayer~=nil;
Player = game.Players.LocalPlayer
Human = Player.Character:FindFirstChild("Humanoid")
Character = Player.Character
Tool = script.Parent
Lasso = nil
Mode = "Pants"
Icons = {
    Shirt = "";
    Pants = ""; -- this is the pants icon for the tool, change it to anything u want
}


function Get(Type,Model,ReturnType)
    local ModelChildren = Model:GetChildren()
    for i = 1,#ModelChildren do
        if ModelChildren[i]:IsA(Type) then
            if ReturnType == "Check" then
                return true
            else
                return ModelChildren[i]
            end
        end
    end
    if ReturnType == "Check" then
        return false
    else
        return nil
    end
end

if Get("Shirt",Character,"Check") then OldShirt = Get("Shirt",Character,"Grab"):Clone() end
if Get("Pants",Character,"Check") then OldPants = Get("Pants",Character,"Grab"):Clone() end

Tool.Equipped:connect(function(Mouse)
    Tool.TextureId = Icons[Mode]
    ActCon = Tool.Activated:connect(function()
        if Mouse.Target ~= nil then
            if Mouse.Target:IsA("BasePart") then
                if Get("Shirt", Mouse.Target.Parent,"CHeck") or Get("Pants", Mouse.Target.Parent,"Check") then
                    if not game.Players:GetPlayerFromCharacter(Mouse.Target.Parent) then
                        if Lasso ~= nil then Lasso:Destroy(); end
                        Lasso = Instance.new("SelectionPartLasso",Player.PlayerGui)
                        Lasso.Humanoid = Human
                        Lasso.Part = Mouse.Target

                        if Mode == "Shirt" then
                            if Get("Shirt",Character,"Check") then
                                Get("Shirt",Character,"Grab").ShirtTemplate = Get("Shirt",Mouse.Target.Parent,"Grab").ShirtTemplate
                            else
                                Instance.new("Shirt",Character).ShirtTemplate = Get("Shirt",Mouse.Target.Parent,"Grab").ShirtTemplate
                                Character.Clothing.Name = "Shirt"
                                Creator = "Nikilis"
                            end 
                        else
                            if Get("Pants",Character,"Check") then
                                Get("Pants",Character,"Grab").PantsTemplate = Get("Pants",Mouse.Target.Parent,"Grab").PantsTemplate
                            else
                                Instance.new("Pants",Character).PantsTemplate = Get("Pants",Mouse.Target.Parent,"Grab").PantsTemplate
                                Character.Clothing.Name = "Pants"
                            end
                        end
                    end
                end
            end
        end 
    end)
    Tool.Unequipped:connect(function()
        if Lasso ~= nil then
            Lasso:Destroy()
            Lasso = nil --nikilis
            if RemoveClothesWhenToolDeselected then
                if Get("Shirt",Character,"Check") then Character.Shirt:Destroy() end
                if Get("Pants",Character,"Check") then Character.Pants:Destroy() end
                if OldShirt ~= nil then OldShirt.Parent = Character end
                if OldPants ~= nil then OldPants.Parent = Character end
            end
        end
        Tool.Name = "try on - pants" -- you can edit the name here, this is the pants one so i named it try on pants
        Tool.TextureId = ""
        ActCon:disconnect()
    end)

    Mouse.KeyDown:connect(function(Key)
        if Key == '' then
            if Mode == "Shirt" then
                Mode = "Pants"
                Tool.TextureId = Icons[Mode]
            else
                Mode = "Shirt"
                Tool.TextureId = Icons[Mode]
            end
        elseif Key == 'e' then -- pressing e destorys what ur wearing, i'm pretty sure
            if Get("Shirt",Character,"Check") then Character.Shirt:Destroy() end
            if Get("Pants",Character,"Check") then Character.Pants:Destroy() end
            if OldShirt ~= nil then OldShirt.Parent = Character end
            if OldPants ~= nil then OldPants.Parent = Character end
        end
    end)

end)

duplicate this twice, one for shirt, one for pants and put them both in the starter pack. make sure to have a Handle, you can change it to anything you want. change the image ID depending on which is which, and the name.

0
tysm! aaattas0987 6 — 2y
Ad