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

Cloning and welding a morph from ServerStorage to the Torso?

Asked by 8 years ago
script.Parent.MouseButton1Down:connect(function()
    local Player = script.Parent.Parent.Parent.Parent.Parent
    if Player.Character:FindFirstChild("Humanoid") ~= nil and Player.Character:FindFirstChild("BTorso") ~= nil then
        local suit = game.ServerStorage.Morphs.Police.Standard["BTorso"]:Clone()
        suit.Parent = Player.Character
        local G = suit:GetChildren()
        for i=1, #G do
            if G[i].ClassName == "Part" or "UnionOperation" then
                local suitW = Instance.new("Weld")
                suitW.Part0 = suit.MainPart
                suitW.Part1 = G[i]
                local autoW = CFrame.new(suit.MainPart.Position)
                suitW.C0 = suit.MainPart.CFrame:inverse()*autoW
                suitW.C1 = G[i].CFrame:inverse()*autoW
                suitW.Parent = suit.MainPart
            end
            local bpW = Instance.new("Weld")
            bpW.Part0 = Player.Character["Torso"]
            bpW.Part1 = suit.MainPart
            bpW.C0 = CFrame.new(0,0,0)
            bpW.Parent = suit.MainPart
        end
        local f = suit:GetChildren()
        for i=1, #f do
            f[i].Anchored = false
            f[i].CanCollide = false
        end
    end 
end)

I ended up making this script so that I could use a GUI to clone and weld parts onto the players' torso. I'm not sure why it's not working? There's nothing in output, and nothing happens when I click the button. Any help?

0
NOTE: This is being run from a GUI button using a regular Script. The morph model that I want attaching to the player is in ServerStorage, inside three folders. BritishActuaI 44 — 8y
0
You shouldn't be using a regular script, and you should be using Replicated Storage. This might not be the problem, but it's a problem. OldPalHappy 1477 — 8y
0
Didn't make a difference, honestly. BritishActuaI 44 — 8y
0
ReplicatedStorage and LocalScript won't add requests to the server and will leave it to the client computer to execute. Meaning less server lag and more user computer performance needed instead. Sir_Melio 221 — 8y
View all comments (2 more)
0
So basicly, if this is being ran by the client, it wont let you use server storage. You should put the model in replicated storage. seccond of all, why dont you just make a script in workspace, since you in the future might want to work with filtering enabled, and use remote functions and events to trigger and handle it all? Abstract_Life 65 — 8y
0
I have problems like this sometimes... I think I can help you just give me some time. terkeypie 0 — 8y

Answer this question