So, my script says there isn’t a part in the tool when there clearly is. If you can help me figure it out, I will be grateful. Ty!
Layout:
Error:
DetectArea is not a valid member of Tool "Workspace.PizzaArmy333.Basic Detector"
Line 1
Script:
local DetectArea = script.Parent.DetectArea --Error here
local beepSound = script.Beep
local anim = script.Animation
local canDetect = {"TestPart", "Soda Can"}
DetectArea.Touched:Connect(function(hit)
local hum = script.Parent.Parent.Humanoid
local loadanim = hum.Animator:LoadAnimation(anim)
loadanim:Play()
if table.find(canDetect, hit.Name) then
beepSound:Play()
if not hit:FindFirstChild("SparkleEffect") then
local marker = game.ReplicatedStorage.SparkleEffect:Clone()
marker.Parent = hit
marker.Position = hit.Position
wait(0.5)
hit.Position = script.Parent.Pos.Position
marker.Position = hit.Position
end
end
end)