#(Help) If/Then not using else Statement

59 messages · Page 1 of 1 (latest)

vocal monolith
#

Intended purpose of script:

When part collides with player, typically the holder they can now jump. 

IF the part collides with something other than the player the part should become transparent & non-collidable (Simulated Deletion)

My Script:

local block = script.Parent


block.Touched:Connect(function(hit)
    
    if hit.Parent:WaitForChild("Humanoid") then
        local Humanoid = hit.Parent:WaitForChild("Humanoid")
        Humanoid.JumpHeight = 1
    else
        hit.CanCollide = false
        hit.Transparency = 0.5
        wait(1.5)
        hit.Transparency = 1
    end
end)
#

incase colors help anyone screenshot attached

swift galleon
vocal monolith
umbral quest
#

So whats the issue?

vocal monolith
#

it ignores the else

swift galleon
#
local block = script.Parent

block.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local humanoid = hit.Parent.Humanoid
        humanoid.JumpHeight = 1
    else
        block.CanCollide = false
        block.Transparency = 0.5
        wait(1.5)
        block.Transparency = 1
    end
end)
vocal monolith
#

instead of waiting it looks for it

#

waiting will never end

swift galleon
#

no, its just that u used properties

#

on hit

vocal monolith
#

o

swift galleon
#

instead of block

vocal monolith
vocal monolith
#

guess I can do a

swift galleon
#

its just go invisible

vocal monolith
#

is there a way for me to do
if hit.Name = "block" then

end

#

to keep it from invising itself

swift galleon
#

but

#

u make it go invislb

#

invisible

#

just make it dont go invisble

#

@umbral quest its ur case now

vocal monolith
umbral quest
#

say whaaaa

vocal monolith
#

so it constantly fights itself lol

umbral quest
#

So what part you want to modify collision and transparency

vocal monolith
#

OH WAIT

vocal monolith
#

instead of doin block

#

I need to do hit

vocal monolith
#

it isnt touching itself I just have it so it modifies itself

vocal monolith
umbral quest
#

And whats different from your original script agony

vocal monolith
swift galleon
#

atwaontiawhtnoiwantiaowhntwa

vocal monolith
#

block is the tool

swift galleon
#

that's some gaming

vocal monolith
#

hit is what the tool touches

swift galleon
#

bro fixed his own apparently already working code

vocal monolith
#

originally the script said

If tool touches something then tool properties change

umbral quest
vocal monolith
#

flipped it to if tool touches something then hit properties change

vocal monolith
#

im supposed to b making a taser and I made this

swift galleon
#

what

#

bro stole the post

#

of this guy

#

its not ur post

#

fam

umbral quest
#

Moron, dont ask for help in someone's else post