So Idk if its possible but just wanted to ask, I am making this gun that if a player is 5 studs away from it, when activated they die, is that possible?
Yes, it is possible. You need to use something called magnitude
to detect how far away the player is from a part.
local camera = game.Workspace.CurrentCamera local part = workspace.SomePart --Locate your part here local studsAway = 18 --set how many studs you the player needs to be in range of game:GetService("RunService").RenderStepped:connect(function() if (camera.CoordinateFrame.p - part.Position).magnitude < studsAway then --do something print("hey") end end)
**Please accept my answer if this helped! **
local magnitude = (part1.Position - part2.Position).magnitude print(magnitude) if math.floor(magnitude) < 5 then --code end
.magnitude calculates the distance between two parts, hope this helped you! accept if it helped you solve your problem!