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

How to make it so you turn unvisible when your press a text button?

Asked by 4 years ago

So i have a game were your in a lobby and you can only see yourself. I made it so your not invisible but all the other players are. So to a players eye they only see there own character. But i have a text button "Play" so when they press that button they are supposed to fight each other.. the thing is they are invisible accept for them self's how to i make it when they press that text button it undos the invisible script.

while wait(1) do
local hide = true

local orignalTransparency = {}

local function checkPart(part)
    for a,b in pairs(part:GetChildren()) do 
        checkPart(b) 
    end
    if part:IsA("BasePart") or part:IsA("Decal") then
        if hide then 
            if not orignalTransparency[part] then
                orignalTransparency[part] = part.Transparency
            end
            part.Transparency = 1

        else 
            if orignalTransparency[part] then 
                part.Transparency = orignalTransparency[part] 
                orignalTransparency[part] = nil 
            end
        end
    end
end

local players = game:GetService("Players")
local localPlayer = players.LocalPlayer

game:GetService("RunService").RenderStepped:Connect(function()
    for i,v in pairs(players:GetPlayers()) do
        if v ~= localPlayer then
            local char = v.Character
            if char then
                checkPart(char)
                char:WaitForChild("Head").OverHead.Enabled = false
            end
        end
    end

    for part,trans in pairs(orignalTransparency) do
        if not part then
            orignalTransparency[part] = nil
        elseif not part.Parent then
            orignalTransparency[part] = nil
        end
    end
end)

while true do
    hide = true
    wait(2.5)
end
end

1 answer

Log in to vote
0
Answered by 4 years ago

Try disabling the script. Just say: TheScriptYouWantToStop.Disabled = true

BaseScript.Disabled

0
but how would the script work then if its always disabled? DataCordz 6 — 4y
0
oh yeah i forgot the script is in startergui so i made it so you can only see yourself. Because i have a lobby with cam manipulation. I also have a text button "Play" so when a player presses it it will stop the "HidePlayer" script and when they are in the lobby the script will run again DataCordz 6 — 4y
Ad

Answer this question