I have a cone giving script but every time I click on the cone it gives me atleast 4 cones instead of one. HELP here is the script -- ALSO, THE ANIMATION DOESNT PLAY SO WHEN THE CONE IS EQUIPPED AND SOMEONE CLICKS, IT DOESNT PLAY THE EATING ANIMATION HELPPP

["ConeGiver"] = function(Machine)
		local Touch = Machine.Touch
		if Touch:FindFirstChildOfClass("ClickDetector") then
			Touch.ClickDetector.MouseClick:Connect(function(Player)
				local Sound = Touch:FindFirstChildOfClass("Sound")
				if Sound then
					Sound:Stop()
					wait()
					Sound:Play()
				end
				local Cone = Machine.Cone:Clone()
				local Tool = Instance.new("Tool",Player.Backpack)
				Tool.Name = "Cone"
				Tool.CanBeDropped = false
				local Handle = Cone:WaitForChild("Handle")
				for _,Part in pairs(Cone:GetChildren()) do
					if Part.Name ~= "Handle" then
						local Weld = Instance.new("Weld",Part)
						Weld.Part0 = Part
						Weld.Part1 = Handle
						Weld.C0 = Part.CFrame:inverse()
						Weld.C1 = Handle.CFrame:inverse()
						wait()
					end
					Part.Anchored = false
					Part.Parent = Tool
					wait()
				end
				local DrinkScript = script:WaitForChild("Drink"):Clone()
				DrinkScript.Parent = Tool
				DrinkScript.Disabled = false
			end)
		end
	end,
}

1 comment

0

You might be connecting multiple MouseClick events to the same click detector?