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

I did a script with someone and now its mess up. can anyone help me please?

Asked by
Choobu 59
6 years ago
Edited 6 years ago

Me and someone from scripting helpers made this invisible script, that is Press m to activate and deactivate, turns body invisible but you can still see hats but no faces, and have a cooldown like 12 seconds to reuse. Somehow its not even working now after I test it out in my game anyone got a idea or can help me fix it up?

local UserInputService = game:GetService('UserInputService')
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character and plr.Character:FindFirstChild('HumanoidRootPart')
local char = plr.Character
local Debounce = false --To prevent from happening too many times.
local Enabled = false --So it can be used again

UserInputService.InputBegan:Connect(function(Input,GPE)
    if Input.KeyCode == Enum.KeyCode.M then
        if Enabled == false and Debounce == false then
            Debounce = true
            for i,v in pairs(plr.Character:GetChildren()) do
                if v:IsA('BasePart') and not v.Name == 'HumanoidRootPart' then
                    v.Transparency = 1
                end
            end
            wait(3) --Debounce wait time
            Debounce = false
        elseif Enabled == true and Debounce == false then
            Debounce = true
            for i,v in pairs(plr.Character:GetChildren()) do
                if v:IsA('BasePart') and not v.Name == 'HumanoidRootPart' then
                    v.Transparency = 0
                end
            end
            wait(3) --Debounce wait time
            Debounce = false
        end
    end
end)
0
You can always change the version history to the last version and you will get the script back greatneil80 2647 — 6y

1 answer

Log in to vote
1
Answered by
arshad145 392 Moderation Voter
6 years ago

Corrected version.

local UserInputService = game:GetService('UserInputService')
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local Debounce = false --To prevent from happening too many times.
local Enabled = false --So it can be used again

UserInputService.InputBegan:Connect(function(Input,GPE)
    if Input.KeyCode == Enum.KeyCode.M then
        if Enabled == false and Debounce == false then
            Debounce = true
            Enabled = true -- This was not here I put it...
            for i,v in pairs(char:GetChildren()) do
                if v:IsA('BasePart') then
                    v.Transparency = 1
                end
            end
            wait(3) --Debounce wait time
            Debounce = false
        elseif Enabled == true and Debounce == false then
            Debounce = true
            Enabled = false -- I put this also.
            for i,v in pairs(plr.Character:GetChildren()) do
                if v:IsA('BasePart') and v.Name ~= 'HumanoidRootPart' then -- don't use and not == , prefer to use ~= which is not "not equal to ".
                    v.Transparency = 0
                end
            end
            wait(3) --Debounce wait time
            Debounce = false
        end
    end
end)

Thank you for reading ! Goodluck while scripting!

Ad

Answer this question