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

Why does my invisibility tool not work properly?

Asked by 7 years ago

I'm trying to make an invisibility tool that makes your entire body turn invisible, then turn visible again, but for some reason it's not functioning how I would like.

local tool = script.Parent
local debounce = false

function onButton1Down(mouse)
if debounce == false then
debounce = true
    local player = game.Players.LocalPlayer
    for _,m in ipairs(player.Character:GetChildren()) do
        if m.className == "Hat" then
            m.Handle.Transparency = 1
        end
        if m.className == "Part" then
            m.Transparency = 1
        end
        wait(1)
            for _,mm in ipairs(m:GetChildren()) do
                if mm.ClassName == "Decal" then
                    mm.Transparency = 1
                end
                wait(5)
                if mm.ClassName == "Decal" then
                    mm.Transparency = 0
                end
            end
            if m.className == "Hat" then
                m.Handle.Transparency = 0
            end
            if m.className == "Part" then
                m.Transparency = 0
            end
        end
        debounce = false
    end
end


function onSelected(mouse)
    mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

tool.Selected:connect(onSelected)
0
Is there any output errors, or how is not acting correctly? UnleashedGamers 257 — 7y
0
It put out "Selected is not a valid member of Tool". Colby3292 5 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Using wiki.roblox.com we can see the members of a "tool,

tool.Selected:connect(onSelected)

is not a valid member becuase you would need to use

Tool.Equipped (when the tool is selected and the mouse is clicked) or Tool.Activated (when the tool is selected)

0
I fixed the error, but now only my head only turns invisible instead of my entire body. Colby3292 5 — 7y
Ad

Answer this question