-
What do you want to achieve? A script that detects if the player is in the radius.
-
What is the issue? Cannot find how to make it detect if the player is there
-
What solutions have you tried so far? Looked on the toolbox and the forums and couldn’t find anything. I tried out the script below, but it doesn’t work well and lags alot. This was just a concept to see if my script could atleast detect the player moving in and out of the field.
script.Parent.Touched:Connect(function(part)
if part.Parent:IsA("Model") and part.Parent.PrimaryPart ~= part then
print("no")
end
if part.Parent:FindFirstChild("Humanoid") then
local plrname = part.Parent.Name
local plrObj = game.Players:FindFirstChild(plrname)
if plrObj ~= nil then
local targetting = true
while targetting == true do
wait()
print("targetting!")
script.Parent.TouchEnded:Connect(function(part2)
local plrname2 = part2.Parent.Name
local plrObj2 = game.Players:FindFirstChild(plrname2)
if part2.Parent:IsA("Model") and part2.Parent.PrimaryPart ~= part2 then
print("no")
else
targetting = false
wait(2)
end
end)
end
end
end
end)
I would appreciate someone to point out the issues in this script, as it is my first time trying this. Thanks.