#Scripting client-sided and server-sided

1 messages · Page 1 of 1 (latest)

radiant geyser
#

I can't figure out how to make the "CrouchAbility" change the transparency of the person who used it partially invisible (specifically 0.5) and anyone else looking at them completely invisible

"CrouchReciever" for the transparency to turn fully transparent

(Code is too long so Im gonna spread it out through messages)
local event = game.ReplicatedStorage:WaitForChild("CrouchAbility")

event.OnServerEvent:Connect(function(player)
local char = player.Character
if char then

    local head = char:FindFirstChild("Head")
    local faceClone = nil
    if head then
        local face = head:FindFirstChildOfClass("Decal")
        if face then
            faceClone = face:Clone()
            face:Destroy()
        end
    end

    local humanoid = char:FindFirstChildOfClass("Humanoid")
    local originalDisplayDistanceType = nil
    local originalNameDisplayDistance = nil
    if humanoid then
        originalDisplayDistanceType = humanoid.DisplayDistanceType
        originalNameDisplayDistance = humanoid.NameDisplayDistance
        humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
    end

    for i,v in char:GetChildren() do
        if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
            v.Transparency = 1
        end
    end

    for i,v in char:GetChildren() do
        if v:IsA("Accessory") then
            local handle = v:FindFirstChild("Handle")
            if handle and handle:IsA("BasePart") then
                handle.Transparency = 1
            end
        end
    end

    task.wait(10)
#

Second Part of the code

for i,v in char:GetChildren() do
if v:IsA("BasePart") and v.Name ~= "HumanoidRootPart" then
v.Transparency = 0
end
end

    for i,v in char:GetChildren() do
        if v:IsA("Accessory") then
            local handle = v:FindFirstChild("Handle")
            if handle and handle:IsA("BasePart") then
                handle.Transparency = 0
            end
        end
    end


    if head and faceClone then
        faceClone.Parent = head
    end


    if humanoid and originalDisplayDistanceType ~= nil then
        humanoid.DisplayDistanceType = originalDisplayDistanceType
    end
    if humanoid and originalNameDisplayDistance ~= nil then
        humanoid.NameDisplayDistance = originalNameDisplayDistance
    end
end

end)

vagrant fjord
#

Make it all invisible on the server and use LocalTransparencyModifier on the client, I think this might work