So I have a script here:
tool = script.Parent
player = game.Players.LocalPlayer
mouse = player:GetMouse()
reload = true
tool.Activated:connect(function()
if reload == true then
reload = false
local Part = Instance.new("Part", workspace)
Part.Size = Vector3.new(0.1,0.1,0.1)
Part.Shape = ("Ball")
Part.Position = Vector3.new(-3.5,0.5,4.5)
Part.CFrame = tool.Handle.CFrame
Part.CFrame = CFrame.new(Part.Position,mouse.Hit.p)
local v = Instance.new("BodyVelocity", Part)
v.velocity = Part.CFrame.lookVector *90
v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
local destroy = Instance.new("IntValue", Part)
destroy.Value = 0
Part.Touched:connect(function(hit)
if hit.Name == "Snow" and Part.destroy.Value == 0 then
destroy.Value = 1
Part:Destroy()
local Snow = hit
Snow.Transparency = 0.1
wait(0.1)
Snow.Transparency = 0.2
wait(0.1)
Snow.Transparency = 0.3
wait(0.1)
Snow.Transparency = 0.4
wait(0.1)
Snow.Transparency = 0.5
wait(0.1)
Snow.Transparency = 0.6
wait(0.1)
Snow.Transparency = 0.7
wait(0.1)
Snow:Destroy()
end
end)
wait(3)
reload = true
end
end)
The problem is that when ever I use this script, I can an error in the output that says: Players.Player1.Backpack.Tool.LocalScript:21: attempt to index field 'destroy' (a function value)

2 comments
Have you tried naming it something else?
What do you mean?