if not hit.Parent:FindFirstChild("Humanoid") then return end
if hit.Parent:FindFirstChild("ForceField") then return end
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
Instance.new("ForceField", hit.Parent)
local backpack = player:WaitForChild("Backpack")
local children = backpack:GetChildren()
for _, child in ipairs(children) do
child.Parent = player:WaitForChild("ItemsFolder")
end
end
script.Parent.Touched:Connect(whentouchedOn)
function whentouchedOff(hit)
if not hit.Parent:FindFirstChild("Humanoid") then return end
if hit.Parent:FindFirstChild("ForceField") then
hit.Parent.ForceField:Destroy()
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local backpack = player:WaitForChild("ItemsFolder")
local children = backpack:GetChildren()
for _, child in ipairs(children) do
child.Parent = player:WaitForChild("Backpack")
end
end
end
script.Parent.TouchEnded:Connect(whentouchedOff)```
#hello, i made safezone, and when going from 1 to other(theyre connected but not colliding) it breaks
1 messages · Page 1 of 1 (latest)
Ah ive had this issue too, the best way to fix it is to make a general table with bodyparts and checking if colliding parts are already in the table
whats that
No, just in the same script
Local table = {}
No alr wait i cant make a big example bc phone but
local table = {}
Part.touched:function()
If hit.parent/FindFirstChild("humanoid")
Table.insert(table, hit)
Table is not same as table
And to checj
For i, v in table do
If hit == table then
-- safe = true
Else
Can do the same for leaving
ty man