How do i detect if player is/isnt inside hollow cylinder?

I’m making a battle royale feature for a game I work for and im trying to make the storm. I’ve been having a lot of trouble with it. My main problem is trying to figure out how I detect if the player is/is not inside a hollow cylinder. I’ve tried referring to roblox’s battle royale but I still cant wrap my head around how to still do it. I’ll post my current script here. (Ill just include my problem)

getRadius = function(part)
	return (part.Size.Z<part.Size.Y and part.Size.Z or part.Size.Y)/2
    --[[In the above we are returning the smallest, first we check if Z is smaller
    than Y, if so then we return Z or else we return Y.]]
end;
while true do task.wait(0.2)
	for i,v : Player in pairs(game.Players:GetChildren()) do
		
	task.spawn(function()
		if v:IsA("Player") then
			local character : Model = v.Character
				local storm : MeshPart = script.Parent
				local humanoidPos = character.PrimaryPart.Position * Vector3.new(1, 0, 1)
				local positionDelta = script.Parent.Position - humanoidPos
				local distance = positionDelta.Magnitude
				local pos = (Vector2.new(storm.Position.X, storm.Position.Z) - Vector2.new(character.HumanoidRootPart.Position.X, character.HumanoidRootPart.Position.Z)).Magnitude
				
				
				local damagepart = getRadius(storm)
				
				local damagething = (damagepart/pos*2)
				--if damagething < 1.04 then
				print(damagepart.." Circle Radius")
				print(distance.." Distance")
					--character.Humanoid:TakeDamage(0.6)
				--end]]
				if distance > damagepart then
					
					character.Humanoid:TakeDamage(0.6)
				end
		end
		end)
	end
	end

thanks in advance!

I heavily recommend ZonePlus by ForeverHD.

Alright, ill try this out right now

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.