#for some reason im getting this error?

41 messages · Page 1 of 1 (latest)

split cave
#

heres the script

#
if script.Parent.Parent.h1.Touched or script.Parent.Parent.h2.Touched or script.Parent.Parent.h3.Touched or script.Parent.Parent.h4.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") == false then return end
        local plr = hit.Parent
    if plr.Character then
        if teleporting == false then
            local cha = plr.Character
            local d = false
            for i = 1, #queue do
                if queue[i] == cha.Name then
                    d = true
                end
            end
            if d == false then
                if #queue < ma then
                    table.insert(queue, cha.Name)
                    leave:FireClient(plr)
                end
                plr.CharacterRemoving:Connect(function(ch)
                    for i = 1, #queue do
                        if queue[i] == ch.Name then
                            table.remove(queue, i)
                        end
                    end
                end)
            end
        end
    end
end)

game.ReplicatedStorage.LeaveQueue.OnServerEvent:Connect(function(plr)
    if plr.Character then
        for i = 1, #queue do
            if queue[i] == plr.Character.Name then
                table.remove(queue, i)
            end
        end
    end
end)
#

im getting this error message

split cave
#

ae

#

well im trash at scripting

obsidian gyro
#

It tells you what your missing

split cave
#

i cant tell where

obsidian gyro
#

You forgot to add the 'then' in your if statement

#

Also..

split cave
#

yes but which one because i checked

shell cairn
split cave
#

?

shell cairn
#

this has no then statement

obsidian gyro
#

Touched is an event

split cave
#

ohh

obsidian gyro
#

It returns an event not a boolean

#

You connect to events to run code when something happens in your game

split cave
#

oh i get it

#

thatnks

#

thanks

#

i made the 4 parts into a union and deleted the if statement

wanton lily
shell cairn
#
local _parts = {
    [1]=script.Parent.Parent.h1;
    [2]=script.Parent.Parent.h2;
    [3]=script.Parent.Parent.h3; 
    [4]=script.Parent.Parent.h4;
}

for _,v in next,_parts do
    v.Touched:connect(function(part)
        -- do stuff here
        print('touched by'.. tostring(part))
    end)
end
#

could this be easier?

split cave
#

so its like

script.Parent.Parent.h1.Touched:Connect(function(hit)
shell cairn
#

end)

#

correct

split cave
#

i named the uniion h1 cuz im lazy

#

yeah end is at the end

wanton lily
shell cairn
#

dont know much about building with unions but i had an issue with that before

obsidian gyro
#

You'd just need to change the render fidelity right?

#

In the properties

#

Or wait no

#

I forget what its called SadCat

#

Collision Fidelity duhh

wanton lily