#for the life of me i can't find what the issue is

1 messages · Page 1 of 1 (latest)

true cobalt
#

I'm writing code for a character's moveset, and the first three skills were working just fine, except the invisibility skill, which, when i added immediately broke the entire script. It doesn't return a syntax error, and the logic seems fine to me.

I thought the issue might be with the RemoteEvent, but i can't find any issues with that.

#

InvisibilityHandler

local invisEvent = rs:WaitForChild("InvisibilityEvent")

invisEvent.OnServerEvent:Connect(function(player, makeInvisible)
    local char = player.Character
    if not char then return end
    
    local targetTransparency = makeInvisible and 1 or 0
    
    for _, part in ipairs(char:GetDescendants()) do
        if part:IsA("BasePart") then
            part.Transparency = targetTransparency
        end
    end
end)```
glossy pine
#

well how does it break

true cobalt
#

the entire script just stops working. even the normal sprinting and slash attack don't work

glossy pine
#

what is makeInvisible

#

remove the "if not char then return end" part

#

do something like

#

repeat
task.wait()
char=player.Character
until char==plr.Character

#

and see what happens

true cobalt
#

i found out what the issue was, it was this line

local invisEvent = rs:WaitForChild("InvisibilityEvent")

since i kept the remoteevents in a folder in replicated storage, it was supposed to be rs.Events:WaitForChild or something similar