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

How can i make an accessory transparent with script?

Asked by 4 years ago

its script

local rp = game:GetService("ReplicatedStorage")
local World = rp:WaitForChild("KingRemotes"):WaitForChild("World")
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local TEsound = game.Workspace.SFX.KC.TimeErase
local range = 300
local duration = 10
local TIMEEARASEEFFECT = script.uginga

World.OnServerEvent:Connect(function(Player)
local Stand = workspace:FindFirstChild(Player.Name.." Stand"):WaitForChild("King")

if Stand then
    local Character = Player.Character
    local Humanoid = Character:WaitForChild("Humanoid")
    local HumanoidRP = Character:WaitForChild("HumanoidRootPart")
    local Torso = Character:WaitForChild("UpperTorso")
    local LeftFoot = Character:WaitForChild("LeftFoot")
    local LeftHand = Character:WaitForChild("LeftHand")
    local LeftLowerArm = Character:WaitForChild("LeftLowerArm")
    local LeftLowerLeg = Character:WaitForChild("LeftLowerLeg")
    local LeftUpperArm = Character:WaitForChild("LeftUpperArm")
    local LeftUpperLeg = Character:WaitForChild("LeftUpperLeg")
    local LowerTorso = Character:WaitForChild("LowerTorso")
    local RightFoot = Character:WaitForChild("RightFoot")
    local RightHand = Character:WaitForChild("RightHand")
    local RightLowerArm = Character:WaitForChild("RightLowerArm")
    local RightLowerLeg = Character:WaitForChild("RightLowerLeg")
    local RightUpperArm = Character:WaitForChild("RightUpperArm")
    local RightUpperLeg = Character:WaitForChild("RightUpperLeg")
    local Head = Character:WaitForChild("Head")
    local Face = Head:WaitForChild("face")








            local prevWeld =     
      Stand:WaitForChild("HumanoidRootPart"):WaitForChild
    ("Stand          Weld")
    prevWeld:Destroy()

    Stand:WaitForChild("HumanoidRootPart").CFrame = 
    HumanoidRP.CFrame *         CFrame.new(0,-.5,-3)

    local weld = Instance.new("ManualWeld")
    weld.Name = "Stand Weld"
    weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
    weld.Part1 = HumanoidRP
    weld.C0 = Stand:WaitForChild("HumanoidRootPart").
CFrame:inverse() *  
HumanoidRP.CFrame
    weld.Parent = weld.Part0

    local animControl = Stand:WaitForChild("AnimControl")
    for i, track in pairs(animControl:GetPlayingAnimationTracks()) do
        track:Stop()
    end

    local Spread = animControl:LoadAnimation(script.Spread)
    Spread:Play()

    local Folder = Instance.new("Folder",workspace)
    Folder.Name = Player.Name.." The World"

    local Orb = script.Orb:Clone()
    Orb.CFrame = Stand:WaitForChild("HumanoidRootPart").CFrame
    Orb.Orientation = Character:WaitForChild("HumanoidRootPart").Orientation
    Orb.Parent = Folder
    local goal = {}
    goal.Size = Orb.Size + Vector3.new(2000,2000,2000)
    local info =     
   TweenInfo.new(1,Enum.EasingStyle.Elastic,Enum.EasingDirection.InOut,0,false,.25)
    local tween = TweenService:Create(Orb,info,goal)
    tween:Play()

    spawn(function()
        wait(.5)
        for i, chars in pairs(workspace:GetChildren()) do
            if chars:FindFirstChild("Humanoid") then
                if chars ~= Character then
                    for j, part in pairs(chars:GetChildren()) do
                        if part:IsA("MeshPart") then
                            spawn(function()
                                        TEsound:play()



                                part.Anchored = false
                                Torso.Transparency = 1
                                LeftFoot.Transparency = 1
                                LeftHand.Transparency = 1
                                LeftLowerArm.Transparency = 1
                                LeftLowerLeg.Transparency = 1
                                LeftUpperArm.Transparency = 1
                                LeftUpperLeg.Transparency = 1
                                LowerTorso.Transparency = 1
                                RightFoot.Transparency = 1
                                RightHand.Transparency = 1
                                RightLowerArm.Transparency = 1
                                RightLowerLeg.Transparency = 1
                                RightUpperArm.Transparency = 1
                                RightUpperLeg.Transparency = 1
                                Head.Transparency = 1
                                Face.Transparency = 1

                                TIMEEARASEEFFECT.Parent = game.Lighting         
                                wait(duration)

                                Torso.Transparency = 0
                                LeftFoot.Transparency = 0
                                LeftHand.Transparency = 0
                                LeftLowerArm.Transparency = 0
                                LeftLowerLeg.Transparency = 0
                                LeftUpperArm.Transparency = 0
                                LeftUpperLeg.Transparency = 0
                                LowerTorso.Transparency = 0
                                RightFoot.Transparency = 0
                                RightHand.Transparency = 0
                                RightLowerArm.Transparency = 0
                                RightLowerLeg.Transparency = 0
                                RightUpperArm.Transparency = 0
                                RightUpperLeg.Transparency = 0
                                Head.Transparency = 0
                                Face.Transparency = 0

                                TIMEEARASEEFFECT.Parent = script            

                                part.Anchored = false
                                            TEsound:Stop()


                            end)
                        end
                    end
                end
            end
        end

    end)

    spawn(function()
        wait(1)
        local prevWeld = 
         Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld")
        prevWeld:Destroy()

        Stand:WaitForChild("HumanoidRootPart").CFrame = HumanoidRP.CFrame * 
          CFrame.new(2,0,2)

        local weld = Instance.new("ManualWeld")
        weld.Name = "Stand Weld"
        weld.Part0 = Stand:WaitForChild("HumanoidRootPart")
        weld.Part1 = HumanoidRP
        weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * 
           HumanoidRP.CFrame
        weld.Parent = weld.Part0

        for i, track in pairs(animControl:GetPlayingAnimationTracks()) do
            track:Stop()
        end
        local Idle = animControl:LoadAnimation(script.Idle)
        Idle:Play()
    end)

    wait(duration)
    Debris:AddItem(Orb,1)

    local goal2 = {}
    goal2.Size = Orb.Size - Orb.Size
    local info2 = 
  TweenInfo.new(1,Enum.EasingStyle.Elastic,Enum.EasingDirection.InOut,0,false,.25)
    local tween2 = TweenService:Create(Orb,info2,goal2)
    tween2:Play()

    World:FireClient(Player)

    end
end)

1 answer

Log in to vote
3
Answered by 4 years ago
Edited 4 years ago

Hopefully this works for you:

--// How does this work?
--// It gets the children of the character (a lighter use of getdescendants), but with our checks it only gets the accessory as the 'maketransparent' value. 
--// With this value it can find the Handle and the properties of it.


for _, maketransparent in pairs(Character:GetChildren()) do
 if (maketransparent.ClassName == "Accessory") then
       maketransparent.Handle.Transparency = 1
    end
end

I added explaining to the script to make sure you can understand / learn how to use this function again and can develop your progress in learning lua

0
YES IT WORKS thank you so much, i guess you are new to the site since you have 0 reputation and i respect you helping people <3 themaxogamer 58 — 4y
Ad

Answer this question