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

Invisibility power only working on my screen, Why?

Asked by 2 years ago
Edited 2 years ago

This is an invisibility keybind script you can hold down and it works on my screen but when I was testing and checked the player 2 screen I was still visible. Is there any way I can change it so its invisible on someone else's screen and not visible?

--[[ Varaibles ]]--
local uis=game:GetService("UserInputService");

--[[ Main ]]--

-- pressing
uis.InputBegan:connect(function(input)
    if input.KeyCode==Enum.KeyCode.E then
        print("pressing the key E");
        local TS = game:GetService("TweenService")
        local Info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
        for _, v in pairs(script.Parent:GetDescendants()) do
            if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" and v.Name ~= "LeftFoot" and v.Name ~= "RightFoot" and v.Name ~= "RightLowerLeg" and v.Name ~= "LeftLowerLeg" then
                TS:Create(v, Info, {Transparency=0.9}):Play()
            end
        end
    end
end)

-- left 
uis.InputEnded:connect(function(input)
    if input.KeyCode==Enum.KeyCode.E then
        print("you have stopped");
        local TS = game:GetService("TweenService")
        local Info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
        for _, v in pairs(script.Parent:GetDescendants()) do
            if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" and v.Name ~= "LeftFoot" and v.Name ~= "RightFoot" and v.Name ~= "RightLowerLeg" and v.Name ~= "LeftLowerLeg" then
                TS:Create(v, Info, {Transparency=0}):Play()
            end
        end 
    end
end)
0
Is this located in a localscript? mariohead13 129 — 2y
0
yes it's a local script Funnyskyswagway3 30 — 2y

1 answer

Log in to vote
1
Answered by 2 years ago
Edited 2 years ago

The Transparency is changed client sided so only the client can see the new Transparency. You need to change the Transparency on a server script so other players can see the new Transparency. You can do this with a remote event.

Create a remote event named invisible parented to ReplicatedStorage

--[[ Varaibles ]]--
local uis=game:GetService("UserInputService");

--[[ Main ]]--

-- pressing
uis.InputBegan:connect(function(input)
    if input.KeyCode==Enum.KeyCode.E then
        game.ReplicatedStorage.invisible:FireServer("Began", script)
    end
end)

-- left 
uis.InputEnded:connect(function(input)
    if input.KeyCode==Enum.KeyCode.E then
        game.ReplicatedStorage.invisible:FireServer("Ended", script)
    end
end)

Create a new script in ServerScriptService

game.ReplicatedStorage.invisible.OnServerEvent:Connect(function(plr, var, LocalScript)
        local TS = game:GetService("TweenService")
        local Info = TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
        for _, v in pairs(LocalScript.Parent:GetDescendants()) do
            if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" and v.Name ~= "LeftFoot" and v.Name ~= "RightFoot" and v.Name ~= "RightLowerLeg" and v.Name ~= "LeftLowerLeg" then
        if var == "Began" then
            TS:Create(v, Info, {Transparency=0.9}):Play()
        elseif var == "Ended" then
            TS:Create(v, Info, {Transparency=0}):Play()
        end
            end
        end
end
0
Ty it worked flawlessly ! Funnyskyswagway3 30 — 2y
Ad

Answer this question