I have a turret gun set up to fire at objects that come close to it, it has a long part that activates the gun when its touched, but this conflicts with other things. is there a way to activate a script when an object comes close to it?
--this is the code inside the long part used for activating from a distance--
script.Parent.Touched:Connect(function() script.Parent.Shoot.Disabled = false wait(1) script.Parent.Shoot.Disabled = true end)
--this is the script that gets turned on-- local cannon = script.Parent.Parent local barrel = cannon.Barrel local fireball = cannon.Fireball
local fireballcopy = fireball:Clone() fireballcopy.Parent = game.Workspace fireballcopy.Position = barrel.Position fireballcopy.Script2.Disabled = false fireballcopy.Script1.Disabled = false
is there a way to activate this script from a distance instead of a touched part?