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

How do I make my morph into a morph gui gui?

Asked by 6 years ago

what I mean is that this script is for my morph on a touch part and I was wondering how do I make it work on a gui like if someone press my button gui called Remove

Heres the script:

function onTouch(part) 
local human = part.Parent:findFirstChild("Humanoid") 
if human ~= nil then 
part.Parent:findFirstChild("Head").Transparency = 0
part.Parent:findFirstChild("Torso").Transparency = 1
part.Parent:findFirstChild("Left Arm").Transparency = 1
part.Parent:findFirstChild("Right Arm").Transparency = 1
part.Parent:findFirstChild("Left Leg").Transparency = 1
part.Parent:findFirstChild("Right Leg").Transparency = 1
end 
end 
script.Parent.Touched:connect(onTouch)

0
Remote events User#20388 0 — 6y

1 answer

Log in to vote
0
Answered by
hellmatic 1523 Moderation Voter
6 years ago

Make sure this is a LocalScript and inside the Button.

local Player = game.Players:WaitForChild(game.Players.LocalPlayer.Name)
local Character = Player.Character

local Button = script.Parent

function HIDE()
    for _, v in pairs(Character:GetChildren()) do 
        if v.Name ~= "Head" and v:IsA('BasePart') then -- makes all of the character's parts transparent except for the head
            v.Transparency = 1
        end
    end
end

Button.MouseButton1Click:connect(HIDE)
Ad

Answer this question