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

I need help with my Webbing-Giver scribt. Can you help me please? [closed]

Asked by 4 years ago

Hi, why is the webbing-giver-script not working? I am desperate. Thank you for your help!

local Hat = script.Parent.Parent
Hat.PrimaryPart = Hat:WaitForChild("Torso")
local ClickDetector = script.Parent.Part.ClickDetector

function WeldParts(part0,part1)
    local newWeld = Instance.new("Weld")
    newWeld.Part0 = part0
    newWeld.Part1 = part1
    newWeld.C0 = CFrame.new()
    newWeld.C1 = part1.CFrame:toObjectSpace(part0.CFrame)
    newWeld.Parent = part0
end

ClickDetector.MouseClick:connect(function(Player)
    local Character = Player.Character
    local Torso = Character:WaitForChild("Torso")
    if Character:FindFirstChild(script.Parent.Parent.Name) then
        Character[script.Parent.Parent.Name]:Destroy()
    else
        local NewHat = Hat:Clone()
        NewHat:SetPrimaryPartCFrame(Torso.CFrame)
        NewHat.PrimaryPart:Destroy()
        for _, part in pairs (NewHat:GetChildren()) do
            if part:IsA("BasePart") then
                WeldParts(Torso, part)
                part.CanCollide = false
                part.Anchored = false
            end
        end
        NewHat.Parent = Character
        NewHat.Giver:Destroy()
    end
end)

Sry for my bad englisch :).

Closed as Non-Descriptive by JesseSong

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?