hello everyone, I made a protection zone and when I did, I always appear on the roof of the building to help fix it, even spawn on the ground did not help
function whentouchedOn(hit)
if not hit.Parent:FindFirstChild("Humanoid") then return end
if hit.Parent:FindFirstChild("ForceField") then return end
Instance.new("ForceField", hit.Parent)
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()
end
end
script.Parent.TouchEnded:Connect(whentouchedOff)
local center = game.Workspace.SpawnLocation
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then
Instance.new("ForceField", hit.Parent.HumanoidRootPart)
end
end)
script.Parent.TouchEnded:Connect(function(hit)
if hit.Parent.HumanoidRootPart:FindFirstChild("ForceField") then
hit.Parent.HumanoidRootPart.ForceField:Destroy()
end
end)
local center = game.Workspace.SpawnLocation