Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with tables :l?

Asked by 9 years ago
cubez = {"xXUltraAltraXx","Player"}
cubeceiling.Touched:connect(function(hit)
for i,v in pairs(cubez) do
                if (string.upper(hit.Parent.Name) == string.upper(v)) then

        hit.Parent.Humanoid.Health = 100
elseif hit.Name == "abcdefgzyxwvut" or hit:IsA"BasePart"  then
if hit.Velocity ~= Vector3.new(0,0,0) then
hit.CanCollide = true
hit.Velocity = Vector3.new(0,0,-2500)
end
end
end
end)

Uh ignore the cubeceiling lol but yeah it dosent work im trying to make it so anyone in the table dosent get flung lol please help

0
Table doesn't get flung? There is a table on the first line. EzraNehemiah_TF2 3552 — 9y
0
No i mean when someone touches The cubeceiling and they are in the table cubez they dont get flung xXUltraAltraXx 20 — 9y
0
? EzraNehemiah_TF2 3552 — 9y
0
Sup ultra, you could have just asked me on SB. MessorAdmin 598 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

The problem is that the players name must be equal to every element in the array or they will get "flung".

cubez = {"xXUltraAltraXx","Player"}

cubeceiling.Touched:connect(function(hit)
    local InTable = false
    for i,v in pairs(cubez) do
        if (string.upper(hit.Parent.Name) == string.upper(v)) then
            InTable = true
        end
    end

    if InTable then
        hit.Parent.Humanoid.Health = 100
    elseif hit.Name == "abcdefgzyxwvut" or hit:IsA"BasePart" then
        if hit.Velocity ~= Vector3.new(0,0,0) then
            hit.CanCollide = true
            hit.Velocity = Vector3.new(0,0,-2500)
        end
    end
end)

0
Thanks :D xXUltraAltraXx 20 — 9y
Ad

Answer this question