#making invisibility bubble need help with the script

1 messages · Page 1 of 1 (latest)

primal bison
#

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")

workspace.Bubble.Part.Touched:Connect(function(hit)
local originaltransparencies = {}
local character = hit:FindFirstAncestorOfClass("Model")
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
local head = character:FindFirstChild("Head")
if not humanoid then return end

for _, part in pairs(character:GetDescendants()) do
    if part:IsA("BasePart") then
        originaltransparencies[part] = part.Transparency
        part.Transparency = 1
    end
end

if head then
    local face = head:FindFirstChild("face")
    if face then
        originaltransparencies[face] = face.Transparency
        face.Transparency = 1
    end
end

task.wait(10)

for part, transparency in pairs(originaltransparencies) do
    if part.Parent then
        part.Transparency = transparency
    end
end

end)
this is my code whats wrong with it im not sure how to fix it a grey block is visible on my torso up to my head when i turn visible again. Also when i turn visible again it shows me visible for like 1/4th of a second and then makes me invisible again even tho im not touching the bubble anymore

glad mirage
#

“AI lover”

primal bison
# glad mirage “AI lover”

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")

local debounce = {}

workspace.Bubble.Part.Touched:Connect(function(hit)
local character = hit:FindFirstAncestorOfClass("Model")
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
local head = character:FindFirstChild("Head")
if not humanoid then return end
local hrp = character:FindFirstChild("HumanoidRootPart")

-- Prevent the same character from triggering multiple times
if debounce[character] then return end
debounce[character] = true

local originaltransparencies = {}

for _, part in pairs (character:GetDescendants()) do
    if part:IsA("BasePart") then
        originaltransparencies[part] = part.Transparency
        part.Transparency = 0.5
    end
end

if head then
    local face = head:FindFirstChild("face")
    if face then
        originaltransparencies[face] = face.Transparency
        face.Transparency = 0.5
    end
end
if hrp then
    originaltransparencies[hrp] = hrp.Transparency
    hrp.Transparency = 1
end

task.wait(10)

for part, transparency in pairs(originaltransparencies) do
    if part.Parent then
        part.Transparency = transparency
    end
end

debounce[character] = nil

end)
this is my new code that i made but the humanoidrootpart is still visible with the same transparency what am i doing wrong

glad mirage
#

AI scriptcrying

#

"i made"

#

bro

#

you mean chatgpt made

primal bison
# glad mirage you mean chatgpt made

i obviously used it to help me with the debounce and shit i started TODAY ive never done this shit u expect me to just know everything like what a humanoid is or how to loop?

#

now can you actually try to help or are you just gonna make fun of me

glad mirage
#

im not fixing an AI script

#

nobody is

#

no developer with any dignity will respect someone who codes with AI and passes it off as their own work

primal bison
#

i wrote this all myself the only thing i got help with was debounce or if i didnt understand how to do something

glad mirage
#

its very widley frowned upon

#

you should use it to LEARN

primal bison
glad mirage
#

not to WORK

primal bison
glad mirage
#

NEVER past an ai script into a game

primal bison
#

this has to be ragebait

glad mirage
#

you can look over it though

#

peak imageembarrassedman

primal bison
#

yeah my bad for not reading all of roblox dev help for 30 hours and used gpt to help explain something to me

#

thats on me man