Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with tables :l?

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

4 comments

0

Table doesn't get flung? There is a table on the first line.

0

No i mean when someone touches The cubeceiling and they are in the table cubez they dont get flung

0

?

0

Sup ultra, you could have just asked me on SB.

1 answer

✓ Accepted answer

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)

1 comment

0

Thanks :D

This discussion is preserved as it was. New answers, comments, and votes are closed.